Android Standalone Build Failure


#1

Hello,

I’ve been playing around with my first Expo app, and have successfully been able to test my app on my phone running a packager server on my laptop and using the Expo app on my phone. Early on, I was also able to build a standalone Android APK and successfully ran that on my phone as well.

However, after some changes, while the app still works in the Expo app, I’m getting build failures when trying to build a standalone APK:

[stderr] /src/exponent/android-shell-app/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/AlertFragment.java:37: Error: Avoid non-default constructors in fragments: use a default constructor plus Fragment#setArguments(Bundle) instead [ValidFragment]
[stderr]   public AlertFragment(@Nullable DialogModule.AlertFragmentListener listener, Bundle arguments) {
[stderr]          ~~~~~~~~~~~~~
[stderr] /src/exponent/android-shell-app/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/SupportAlertFragment.java:30: Error: Avoid non-default constructors in fragments: use a default constructor plus Fragment#setArguments(Bundle) instead [ValidFragment]
[stderr]   public SupportAlertFragment(@Nullable DialogModule.AlertFragmentListener listener, Bundle arguments) {
[stderr]          ~~~~~~~~~~~~~~~~~~~~
[stderr]    Explanation for issues of type "ValidFragment":
[stderr]    From the Fragment documentation:
[stderr]    Every fragment must have an empty constructor, so it can be instantiated
[stderr]    when restoring its activity's state. It is strongly recommended that
[stderr]    subclasses do not have other constructors with parameters, since these
[stderr]    constructors will not be called when the fragment is re-instantiated;
[stderr]    instead, arguments can be supplied by the caller with setArguments(Bundle)
[stderr]    and later retrieved by the Fragment with getArguments().
[stderr]    http://developer.android.com/reference/android/app/Fragment.html#Fragment()
[stderr] 2 errors, 0 warnings
:app:transformClassesWithMultidexlistForProdRelease
:app:transformClassesWithDexForProdRelease
[stderr] Dex: Error converting bytecode to dex:
[stderr] Cause: Dex cannot parse version 52 byte code.
[stderr] This is caused by library dependencies that have been compiled using Java 8 or above.
[stderr] If you are using the 'java' gradle plugin in a library submodule add 
[stderr] targetCompatibility = '1.7'
[stderr] sourceCompatibility = '1.7'
[stderr] to that submodule's build.gradle file.
[stderr]     UNEXPECTED TOP-LEVEL EXCEPTION:
[stderr]     java.lang.RuntimeException: Exception parsing classes
[stderr]     	at com.android.dx.command.dexer.Main.processClass(Main.java:781)
[stderr]     	at com.android.dx.command.dexer.Main.processFileBytes(Main.java:747)
[stderr]     	at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
[stderr]     	at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1689)
[stderr]     	at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
[stderr]     	at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
[stderr]     	at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
[stderr]     	at com.android.dx.command.dexer.Main.processOne(Main.java:695)
[stderr]     	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:560)
[stderr]     	at com.android.dx.command.dexer.Main.runMultiDex(Main.java:376)
[stderr]     	at com.android.dx.command.dexer.Main.run(Main.java:290)
[stderr]     	at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
[stderr]     	at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:174)
[stderr]     	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[stderr]     	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[stderr]     	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[stderr]     	at java.lang.Thread.run(Thread.java:748)
[stderr]     Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
[stderr]     	at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:476)
[stderr]     	at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
[stderr]     	at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
[stderr]     	at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
[stderr]     	at com.android.dx.command.dexer.Main.parseClass(Main.java:793)
[stderr]     	at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
[stderr]     	at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1728)
[stderr]     	at com.android.dx.command.dexer.Main.processClass(Main.java:779)
[stderr]     	... 16 more
[stderr]     
[stderr] Dex: Error converting bytecode to dex:
[stderr] Cause: Dex cannot parse version 52 byte code.
[stderr] This is caused by library dependencies that have been compiled using Java 8 or above.
[stderr] If you are using the 'java' gradle plugin in a library submodule add 
[stderr] targetCompatibility = '1.7'
[stderr] sourceCompatibility = '1.7'
[stderr] to that submodule's build.gradle file.
[stderr]     UNEXPECTED TOP-LEVEL EXCEPTION:
[stderr]     java.lang.RuntimeException: Exception parsing classes
[stderr]     	at com.android.dx.command.dexer.Main.processClass(Main.java:781)
[stderr]     	at com.android.dx.command.dexer.Main.processFileBytes(Main.java:747)
[stderr]     	at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
[stderr]     	at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1689)
[stderr]     	at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
[stderr]     	at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
[stderr]     	at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
[stderr]     	at com.android.dx.command.dexer.Main.processOne(Main.java:695)
[stderr]     	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:587)
[stderr]     	at com.android.dx.command.dexer.Main.runMultiDex(Main.java:376)
[stderr]     	at com.android.dx.command.dexer.Main.run(Main.java:290)
[stderr]     	at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
[stderr]     	at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:174)
[stderr]     	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[stderr]     	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[stderr]     	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[stderr]     	at java.lang.Thread.run(Thread.java:748)
[stderr]     Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
[stderr]     	at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:476)
[stderr]     	at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
[stderr]     	at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
[stderr]     	at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
[stderr]     	at com.android.dx.command.dexer.Main.parseClass(Main.java:793)
[stderr]     	at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
[stderr]     	at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1728)
[stderr]     	at com.android.dx.command.dexer.Main.processClass(Main.java:779)
[stderr]     	... 16 more
[stderr]     
[stderr] 2 errors; aborting
 FAILED
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:transformClassesWithDexForProdRelease'.
[stderr] > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 8 mins 17.259 secs
▼running gulp task
[stderr] [00:33:20] 'android-shell-app' errored after 8.4 min
[stderr] [00:33:20] Error: Process exited with non-zero code: 1
[stderr]     at ChildProcess.child.on (/src/exponent/tools-public/node_modules/@expo/spawn-async/build/spawnAsync.js:39:21)
[stderr]     at emitTwo (events.js:125:13)
[stderr]     at ChildProcess.emit (events.js:213:7)
[stderr]     at maybeClose (internal/child_process.js:927:16)
[stderr]     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

Not sure if there’s more information that would be helpful, and not really sure where to go from here. Thanks!


#2

Not sure if it’s relevant, but I am using the expo MapView with a googleMaps API Key in my app.json


#3

Hi, we’re really sorry about this. We’re deploying a fix right now, which should be available soon. You can see updates at https://status.expo.io/ . Let us know if you continue to have issues after the fix is deployed!


#4

Thanks!


closed #5

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.