+1 vote

I am developing app uinsg Ionic Vue and build it using capcitor V2 When build for relase version with mininyEnabled true, then my app is crashing in Andorid phone just after Splash Screen. Here are my logs from android studio. On running the app with mininyEnables it is crashing just after splash screen.

    2021-09-18 13:43:38.934 25121-25121/app.neo.school E/app.neo.school: Invalid ID 0x00000000.
    2021-09-18 13:43:38.934 25121-25121/app.neo.school E/app.neo.school: Invalid ID 0x00000000.
    2021-09-18 13:43:38.946 25121-25121/app.neo.school I/cr_LibraryLoader: Successfully loaded native library
    2021-09-18 13:43:38.948 25121-25121/app.neo.school I/cr_CachingUmaRecorder: Flushed 7 samples from 7 histograms.
    2021-09-18 13:43:39.197 25121-25121/app.neo.school D/EgretLoader: EgretLoader(Context context)
    2021-09-18 13:43:39.201 25121-25121/app.neo.school D/EgretLoader: The context is not activity
    2021-09-18 13:43:39.204 25121-25121/app.neo.school D/Capacitor: Starting BridgeActivity
    2021-09-18 13:43:39.212 25121-25121/System.err: java.lang.ClassNotFoundException: com.gae.scaffolder.plugin.FCMPlugin
    2021-09-18 13:43:39.213 25121-25121/System.err:     at java.lang.Class.classForName(Native Method)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at java.lang.Class.forName(Class.java:454)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at java.lang.Class.forName(Class.java:379)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at i.a.a.o.b(:489)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at i.a.a.o.a(:169)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at i.a.a.o.e(:97)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at i.a.a.o.a(:86)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at com.getcapacitor.f0.c.a(:62)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at com.getcapacitor.d.a(:79)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at com.getcapacitor.d.a(:62)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at com.getcapacitor.d.a(:48)
    2021-09-18 13:43:39.213 25121-25121/System.err:     at app.neo.school.MainActivity.onCreate(:16)android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
    2021-09-18 13:43:39.214 25121-25121/System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
    2021-09-18 13:43:39.214 25121-25121/System.err:     at android.os.Looper.loop(Looper.java:223)
    2021-09-18 13:43:39.214 25121-25121/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7562)
    2021-09-18 13:43:39.214 25121-25121/System.err:     at java.lang.reflect.Method.invoke(Native Method)
    2021-09-18 13:43:39.214 25121-25121/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
    2021-09-18 13:43:39.215 25121-25121/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
    2021-09-18 13:43:39.215 25121-25121/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.gae.scaffolder.plugin.FCMPlugin" on path: DexPathList[[zip file "/data/app/app.neo.school-c3QqG5QHm53pU-YaMFhnXA==/base.apk"],nativeLibraryDirectories=[/data/app/app.neo.school-c3QqG5QHm53pU-YaMFhnXA==/lib/arm64, /system/lib64, /system/product/lib64]]
    2021-09-18 13:43:39.215 25121-25121/System.err:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:230)
    2021-09-18 13:43:39.215 25121-25121/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    2021-09-18 13:43:39.215 25121-25121/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    2021-09-18 13:43:39.215 25121-25121/System.err:    ... 27 more
    2021-09-18 13:43:39.216 25121-25121/app.neo.school I/System.out: Error adding plugin com.gae.scaffolder.plugin.FCMPlugin.
    2021-09-18 13:43:39.216 25121-25121/app.neo.school D/AndroidRuntime: Shutting down VM
    2021-09-18 13:43:39.219 25121-25121/app.neo.school E/AndroidRuntime: FATAL EXCEPTION: main
        Process: app.neo.school, PID: 25121
        java.lang.RuntimeException: Unable to start activity ComponentInfo{app.neo.school/app.neo.school.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void i.a.a.g.a(java.lang.String, i.a.a.e, i.a.a.j, i.a.a.h)' on a null object reference
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3308)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3457)
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:223)
            at android.app.ActivityThread.main(ActivityThread.java:7562)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
         Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void i.a.a.g.a(java.lang.String, i.a.a.e, i.a.a.j, i.a.a.h)' on a null object reference
            at i.a.a.o.a(:171)
            at i.a.a.o.e(:97)
            at i.a.a.o.a(:86)
            at com.getcapacitor.f0.c.a(:62)
            at com.getcapacitor.d.a(:79)
            at com.getcapacitor.d.a(:62)
            at com.getcapacitor.d.a(:48)
            at app.neo.school.MainActivity.onCreate(:16)
            at android.app.Activity.performCreate(Activity.java:7906)
            at android.app.Activity.performCreate(Activity.java:7893)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3283)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3457) 
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044) 
            at android.os.Handler.dispatchMessage(Handler.java:107) 
            at android.os.Looper.loop(Looper.java:223) 
            at android.app.ActivityThread.main(ActivityThread.java:7562) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) 
    

Please help me to resolve this error.

in Other by
retagged by

1 Answer

0 votes

Hello @manisha,

Looks like Proguard wasnt able to handle properly. I added the following line to proguard-rules.pro file located inside app folder and the problem disappeared:

You can only keep items indeed. If you want to exclude certain class members, you have to do so by listing or annotating the class members that you do want to keep. When specifying a class name, you can provide a list, optionally with "!" to exclude names. When specifying a class member name and type, that is not possible. Still, in both cases, you can use wildcards. If you pick special names for your internal classes, this might work:

-keep public class * {
  public protected *** !myInternalField*;
  public protected *** !myInternalMethod*(...);
}

OR

-keep class * {
    public private *;
}

 

by