Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClassNotFoundException for Activity after signing apk

While I'm testing the debug version of my app — it's OK. After I sign it for Google Play release — it starts to FC with the following exception:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.wiagames.guitartuner/com.wiagames.guitartuner.activities.MainActivity}: java.lang.ClassNotFoundException: com.wiagames.guitartuner.activities.MainActivity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.wiagames.guitartuner.activities.MainActivity
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)

Manifest:

 <application android:label="@string/app_name"
                 android:icon="@drawable/ic_launcher">

        <activity android:name=".activities.MainActivity"
                  android:label="@string/app_name"
                  android:configChanges="orientation|keyboardHidden"
                  android:theme="@style/AppTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <activity android:name="com.google.ads.AdActivity"
                  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

    </application>

How to fix it?

like image 339
artem Avatar asked Dec 20 '12 14:12

artem


1 Answers

Could you post your application manifest file?

My suspicion is that the declaration of the activity is not correct.

It should look something like the following:

<activity android:name="com.wiagames.guitartuner.activities.MainActivity" /> 

Or if you've already got a package declaration then it should like like:

<activity android:name=".activities.MainActivity" /> 

Note that you need a leading period (i.e. ".") in the name value.

like image 102
AndroidGuy Avatar answered Sep 30 '22 06:09

AndroidGuy