Java Question java.lang.RuntimeException: Unable to start activity ComponentInfo

cambopad

Active Member
Licensed User
Longtime User
Dear all!

I am trying to integrate AppNext SDK into my test project using inline Java! The java code to integrate is simple, but I cannot get it working at all since the app always crashed whenever the app started. I found the codes that caused this error, but I don't know how to fix it at all.

The codes that cause this error is:
B4X:
        interstitial = new Interstitial(this, placementID);

Note: The variable "interstitial" was already declared:
B4X:
Interstitial interstitial;


The logs of the this error is:

B4X:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.supersonic.test/com.supersonic.test.main}: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
    at android.app.ActivityThread.access$800(ActivityThread.java:135)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5001)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.BA.runHook(BA.java:163)
    at com.supersonic.test.main.onCreate(main.java:77)
    at android.app.Activity.performCreate(Activity.java:5231)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
    ... 11 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.runHook(BA.java:160)
    ... 15 more
Caused by: java.lang.VerifyError: com/appnext/core/f
    at com.appnext.core.m.a(SourceFile:48)
    at com.appnext.ads.interstitial.Interstitial.e(SourceFile:216)
    at com.appnext.ads.interstitial.Interstitial.d(SourceFile:75)
    at com.appnext.ads.interstitial.Interstitial.<init>(SourceFile:52)
    at com.supersonic.test.main._onCreate(main.java:533)
    ... 18 more

Can anyone help me with this? I don't know why it always crushes and shows error log like this!
 

DonManfred

Expert
Licensed User
Longtime User
Give the Object another Name. Different from the classname

Interstitial interstitial;
B4X:
Interstitial inter;
inter  = new interstitial......
 

cambopad

Active Member
Licensed User
Longtime User
did you add the activity-related part to manifest?
Yes, I already added the activity-related part to the manifest. This are the codes in the manifest:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
   
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    )
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")

'AppNext
AddApplicationText(

           android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>


        <service android:name="com.appnext.core.DownloadService" />
        <activity android:name="com.appnext.ads.interstitial.InterstitialActivity"
                  android:hardwareAccelerated="true"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
        <activity android:name="com.appnext.ads.fullscreen.FullscreenActivity"
                  android:hardwareAccelerated="true" android:configChanges="keyboardHidden|orientation|screenSize"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
)

I don't know why it always show error like that!
 
Top