Skip to content
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

NullPointerException when building app with maven #14

Closed
patrickhammond opened this issue Jan 29, 2014 · 7 comments
Closed

NullPointerException when building app with maven #14

patrickhammond opened this issue Jan 29, 2014 · 7 comments

Comments

@patrickhammond
Copy link

Getting this when trying to build the app with Maven:

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ app ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO] Compiling 28 source files to /Users/[path]/android/app/target/classes
Exception in thread "pool-3-thread-1" java.lang.NullPointerException
    at com.sun.tools.javac.model.JavacElements.cast(JavacElements.java:627)
    at com.sun.tools.javac.model.JavacElements.getPackageOf(JavacElements.java:362)
    at org.androidtransfuse.adapter.element.ASTElementFactory.buildPackageClass(ASTElementFactory.java:130)
    at org.androidtransfuse.adapter.element.ASTElementFactory.buildType(ASTElementFactory.java:87)
    at org.androidtransfuse.adapter.element.ASTElementFactory.getType(ASTElementFactory.java:78)
    at org.parceler.internal.ReloadableASTElementFactory$ReloadableASTTypeProvider.get(ReloadableASTElementFactory.java:66)
    at org.parceler.internal.ReloadableASTElementFactory$ReloadableASTTypeProvider.get(ReloadableASTElementFactory.java:54)
    at org.parceler.internal.ParcelTransactionWorker.innerRun(ParcelTransactionWorker.java:52)
    at org.parceler.internal.ParcelTransactionWorker.innerRun(ParcelTransactionWorker.java:34)
    at org.androidtransfuse.transaction.AbstractCompletionTransactionWorker.run(AbstractCompletionTransactionWorker.java:35)
    at org.androidtransfuse.transaction.CodeGenerationScopedTransactionWorker.innerRun(CodeGenerationScopedTransactionWorker.java:47)
    at org.androidtransfuse.transaction.AbstractCompletionTransactionWorker.run(AbstractCompletionTransactionWorker.java:35)
    at org.androidtransfuse.transaction.ScopedTransactionWorker.run(ScopedTransactionWorker.java:55)
    at org.androidtransfuse.transaction.Transaction.run(Transaction.java:77)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)

POM dependencies:

<dependency>
    <groupId>org.parceler</groupId>
    <artifactId>parceler</artifactId>
    <version>0.2.5</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.parceler</groupId>
    <artifactId>parceler-api</artifactId>
    <version>0.2.5</version>
</dependency>

This looks like it could be related to: johncarl81/transfuse#69

@johncarl81
Copy link
Owner

@patrickhammond Yes, this is related. Does compilation and code generation complete successfully despite the stacktrace? Also, this should be fixed in upcoming 0.2.6 release and you can test it out in the current 0.2.6-SNAPSHOT.

@patrickhammond
Copy link
Author

It looks like compilation and code generation were occurring. Not seeing this error in 0.2.6-SNAPSHOT.

Unrelated, are there any proguard flags that are required that you're aware are needed? Running into runtime crashes in a proguarded app where Parcels line 149 (findClass) is returning a null value and causing line 135 (ParcelCodeRepository.get) to throw a ParcelerRuntimeException.

Can put together a sample project later if needed.

@johncarl81
Copy link
Owner

Fantastic.

Proguard is probably removing the org.parceler.Parceler$$Parcels class which is required for the Parcels utility class to run. Most everything else should be statically linked through that class. So this may do the trick:

-keep org.parceler.Parceler$$Parcels

@patrickhammond Could you confirm so that this could be added to the readme.

I'll also look at issuing a solid release of Parceler in the coming week.

@patrickhammond
Copy link
Author

This looks like the winning combination:

-keep interface org.parceler.Parcel
-keep @org.parceler.Parcel class * { *; }
-keep class **$$Parcelable { *; }
-keep class org.parceler.Parceler$$Parcels

Just sent in #15 with a minimal app using this configuration.

@patrickhammond
Copy link
Author

Might also consider replacing the top line with -keep interface org.parceler.** to capture all of the annotations.

@johncarl81
Copy link
Owner

@patrickhammond I believe this is fixed via johncarl81/transfuse#69. Please let me know if you see this anymore.

@johncarl81
Copy link
Owner

Closing as I have not seen this personally or been notified of it happening. Feel free to reopen if this is witnessed again.

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

No branches or pull requests

2 participants