0 Replies Latest reply on Sep 7, 2016 9:24 PM by xybrek

    Build Android APK

    xybrek Newbie

      I have a question about Errai Cordova, I am trying to build an APK but mvn package is looking for a www/config.xml file (even on the GitHub - errai/errai-tutorial: Errai tutorial project) the problem is that it does not exist so I added it (although I am not sure if it should be added manually or not) to make the plugin works but when I run it again it throws:

       

      Error: A library uses the same package as this project: io.cordova.hellocordova You can temporarily disable this error with android.enforceUniquePackageName=false However, this is temporary and will be enforced in 1.0

      Now I tried to replace the widget id= with a different package name than io.cordova.hellocordova and the plugin worked. Running the mvn package built the apk. However installing it did not work both on emulator and real device, checking the Android logs I can see errors:

       

      09-07 23:58:36.260 I/ActivityManager(  324): Start proc io.cordova.hellocordova for activity io.cordova.hellocordova/.MainActivity: pid=1540 uid=10055 gids={50055, 3003, 1015, 1028}

      09-07 23:58:36.676 D/        (   57): Socket deconnection

      09-07 23:58:36.768 I/qtaguid (  324): Failed write_ctrl(s 1 10055) res=-1 errno=1

      09-07 23:58:36.768 W/NetworkManagementSocketTagger(  324): setKernelCountSet(10055, 1) failed with errno -1

      09-07 23:58:36.940 D/AndroidRuntime( 1540): Shutting down VM

      09-07 23:58:36.940 W/dalvikvm( 1540): threadid=1: thread exiting with uncaught exception (group=0xa6226908)

      09-07 23:58:36.956 E/AndroidRuntime( 1540): FATAL EXCEPTION: main

      09-07 23:58:36.956 E/AndroidRuntime( 1540): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{io.cordova.hellocordova/io.cordova.hellocordova.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "io.cordova.hellocordova.MainActivity" on path: /data/app/io.cordova.hellocordova-2.apk

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at android.app.ActivityThread.access$600(ActivityThread.java:141)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at android.os.Handler.dispatchMessage(Handler.java:99)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at android.os.Looper.loop(Looper.java:137)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at android.app.ActivityThread.main(ActivityThread.java:5041)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at java.lang.reflect.Method.invokeNative(Native Method)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at java.lang.reflect.Method.invoke(Method.java:511)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at dalvik.system.NativeStart.main(Native Method)

      09-07 23:58:36.956 E/AndroidRuntime( 1540): Caused by: java.lang.ClassNotFoundException: Didn't find class "io.cordova.hellocordova.MainActivity" on path: /data/app/io.cordova.hellocordova-2.apk

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at android.app.Instrumentation.newActivity(Instrumentation.java:1054)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)

      09-07 23:58:36.956 E/AndroidRuntime( 1540):     ... 11 more

      09-07 23:58:36.992 W/ActivityManager(  324):   Force finishing activity io.cordova.hellocordova/.MainActivity

      09-07 23:58:38.260 D/dalvikvm(  324): GC_FOR_ALLOC freed 2588K, 30% free 6966K/9832K, paused 81ms, total 84ms

      09-07 23:58:38.368 D/dalvikvm(  324): GC_FOR_ALLOC freed 49K, 20% free 7876K/9832K, paused 41ms, total 42ms

      09-07 23:58:38.384 I/dalvikvm-heap(  324): Grow heap (frag case) to 8.035MB for 225516-byte allocation

       

      What could be the problem here?