Skip to content

Add android.jar to the searchable jars list for error checking stuffs #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 17, 2015
Merged

Conversation

omerjerk
Copy link
Contributor

No description provided.


String androidJarPath = sdk.getSdkFolder().getAbsolutePath() + "/platforms/"
+ "android-" + AndroidBuild.sdkVersion + "/android.jar";
System.out.println("androidJarPath = " + androidJarPath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidental debug string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry. Pushing the fixed commit over it.

codeanticode added a commit that referenced this pull request Aug 17, 2015
Add android.jar to the searchable jars list for error checking stuffs
@codeanticode codeanticode merged commit 4a23474 into processing:master Aug 17, 2015
@codeanticode codeanticode mentioned this pull request Aug 17, 2015
@Manindra29
Copy link
Member

@omerjerk, a couple of things I noticed:

If the searchPath contains 2 files: FileA, FileB, I believe they should be separated by a : , as we do it in the system PATH environment variable.

String searchPath = FileA.getAbsolutePath() + File.pathSeparatorChar + FileB.getAbsolutePath();

I think it should be return super.getSearchPath() + File.pathSeparatorChar + androidJarPath;

Also it's a bad idea to add / char in the path string. Please use the system independent File.pathSeparator

@codeanticode
Copy link
Contributor

@Manindra29 I applied the changes you suggested, but the problem is that sdk is null when getSearchPath() is called. @omerjerk any ideas?

@Manindra29
Copy link
Member

Can't we initilalise it or get its value before getSearchPath() is called? @omerjerk

@omerjerk
Copy link
Contributor Author

@codeanticode do you mean this sdk variable is null ? https://github.com/processing/processing-android/blob/master/src/processing/mode/android/AndroidMode.java#L164

I have tested a lot of time but haven't got NPE here at all.
I'm getting NPE here. The classPath variable is somehow null.

@omerjerk
Copy link
Contributor Author

Also, what I do is I've created a test sketch having that android.view.MotionEvent import. I open the IDE via ant run, then go to File->Open Recent->test sketch.
I never get sdk variable null this way.

@codeanticode
Copy link
Contributor

Hi Umair,

I added the following code in the getSearchPath() method:

  public String getSearchPath() {
    System.out.println("in getSearchPath");
    System.out.println("  SDK: " + sdk);
    String androidJarPath = sdk.getSdkFolder().getAbsolutePath() + 
      File.separator + "platforms" + File.separator + "android-" + 
      AndroidBuild.sdkVersion + File.separator + "android.jar";    
    return super.getSearchPath() + File.pathSeparatorChar + androidJarPath;
  }

and I see the following in the terminal when I switch to the android mode from the PDE:

in getSearchPath
  SDK: null
Exception in thread "Thread-12" java.lang.NullPointerException
    at processing.mode.android.AndroidMode.getSearchPath(AndroidMode.java:166)
    at processing.mode.java.pdex.ASTGenerator.loadJars(ASTGenerator.java:310)
    at processing.mode.java.pdex.ErrorCheckerService$1.run(ErrorCheckerService.java:876)
    at java.lang.Thread.run(Thread.java:745)

I'm using the latest revision from Processing.

I also saved a minimal sketch with only the following code:

import android.view.MotionEvent;
void mouseDragged() {
 MotionEvent me = (MotionEvent) mouseEvent.getNative();
}

Every time I open it I get the following error in the PDE console:

java.lang.NullPointerException
    at processing.mode.java.pdex.ASTGenerator.getSuggestImports(ASTGenerator.java:3307)
    at processing.mode.java.pdex.ErrorCheckerService.updateErrorTable(ErrorCheckerService.java:940)
    at processing.mode.java.pdex.ErrorCheckerService.checkCode(ErrorCheckerService.java:492)
    at processing.mode.java.pdex.ErrorCheckerService.run(ErrorCheckerService.java:290)
    at java.lang.Thread.run(Thread.java:745)

@Manindra29
Copy link
Member

I get a null SDK when launching Processing from eclipse. Running the .app directly doesn't show SDK to be null. Any ideas what we might be missing?

@omerjerk
Copy link
Contributor Author

Okay. I'm also getting null sdk when I run from eclipse. Thanks @Manindra29 :)
Let me see what is going wrong.

@omerjerk omerjerk deleted the bugfix branch September 6, 2015 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants