Building Square's "Flow" sample app: Maven success but unusable APK

204 Views Asked by At

I was just trying to build the sample application for Square's Flow libary, specifically the code from this commit:

https://github.com/square/flow/commit/38c1e12d49b20b4f7eeee6a21f339e03dac76394

I used mvn from the command line. It finishes successfully, and the APK can be installed on my device, but cannot be launched. The only suspicous output during the build were a lot of messages like the following:

[INFO] trouble processing:
[INFO] bad class file magic (cafebabe) or version (0033.0000)
[INFO] ...while parsing flow/Backstack$ParcelableBackstack$1.class
[INFO] ...while processing flow/Backstack$ParcelableBackstack$1.class

But as I said, mvn reports "BUILD SUCCESS".

I think the relevant portion of the logcat output is the following:

D/SlideAside(31288): [MainService.java:201:handleNewActivity()] oooooo User executes an App : com.example.flow (filtered)
I/ActivityManager( 935): Start proc com.example.flow for activity com.example.flow/.MainActivity: pid=6973 uid=10506 gids={50506}
V/ActivityManager( 935): Moving to STOPPING: ActivityRecord{435be3b0 u0 com.teslacoilsw.launcher/com.android.launcher2.Launcher t1} (stop requested)
V/ActivityManager( 935): Moving to STOPPED: ActivityRecord{435be3b0 u0 com.teslacoilsw.launcher/com.android.launcher2.Launcher t1} (stop complete)
I/MicrophoneInputStream( 2963): mic_close fib@431d87f
V/AudioRecord( 2963): stop()
D/AudioRecord( 2963): AudioRecord->stop()
V/AudioFlinger( 276): RecordHandle::stop()
V/AudioFlinger( 276): RecordThread::stop
D/dalvikvm( 6973): Debugger has detached; object registry had 1 entries
V/ActivityManager( 935): Moving to RESUMED: ActivityRecord{43aaf978 u0 com.example.flow/.MainActivity t135} (starting new instance)
V/audio_hw_primary( 276): in_standby: enter
D/PhoneApp( 1614): getIsInUseVoLTE : false
D/HyLog ( 6973): I : /data/font/config/dfactpre.dat, No such file or directory (2)
W/System.err( 6973): java.lang.RuntimeException: Unable to instantiate application com.example.flow.DemoApp: java.lang.ClassNotFoundException: Didn't find class "com.example.flow.DemoApp" on path: DexPathList[[zip file "/data/app/com.example.flow-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.flow-1, /vendor/lib, /system/lib]]
W/System.err( 6973): at android.app.LoadedApk.makeApplication(LoadedApk.java:526)
W/System.err( 6973): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4390)
W/System.err( 6973): at android.app.ActivityThread.access$1500(ActivityThread.java:139)
W/System.err( 6973): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1260)
W/System.err( 6973): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 6973): at android.os.Looper.loop(Looper.java:136)
W/System.err( 6973): at android.app.ActivityThread.main(ActivityThread.java:5105)
W/System.err( 6973): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 6973): at java.lang.reflect.Method.invoke(Method.java:515)
W/System.err( 6973): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
W/System.err( 6973): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
W/System.err( 6973): at dalvik.system.NativeStart.main(Native Method)
W/System.err( 6973): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.flow.DemoApp" on path: DexPathList[[zip file "/data/app/com.example.flow-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.flow-1, /vendor/lib, /system/lib]]
W/System.err( 6973): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
W/System.err( 6973): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
W/System.err( 6973): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
W/System.err( 6973): at android.app.Instrumentation.newApplication(Instrumentation.java:975)
W/System.err( 6973): at android.app.LoadedApk.makeApplication(LoadedApk.java:521)
W/System.err( 6973): ... 11 more

I used mvn 3.2.3 and Java 6 for this, but I have also used mvn 3.1.1 and Java 7 with the same results.

Is there something wrong with my mvn paths as some classes are obviously not included in the apk?

UPDATE: Interestingly, the exact same course of action produced a usable APK on my Mac at work (my home machine uses Ubuntu). So I guess that it's just another case of Maven hating me...

0

There are 0 best solutions below