i was busy with my app for over a week, when suddenly:
11-12 07:59:17.860 1653-1653/nl.test.myapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.Runtim
try:
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
https://stackoverflow.com/a/29821331/11480535 worked for me with the little addition that I also had to delete the projectFilesBackup/
!
I had the same problem, turns out I screwed up with some final method.
Be sure to check dalvikvm
errors in logcat output before the FATAL EXCEPTION. I will give you some hints on the problem. In my case, I had a final method (isResumed
) which was already defined in the base class - causing runtime crash. Wasn't complaining at compile time.
Check the logs:
E/dalvikvm( 9984): Method Lcom/your/package/ui/SomeActivity;.isResumed overrides final Landroid/app/Activity;.isResumed
W/dalvikvm( 9984): failed creating vtable
...
D/AndroidRuntime( 9962): Shutting down VM
...
E/AndroidRuntime(10065): FATAL EXCEPTION: main
E/AndroidRuntime(10065): Process: com.yourpackage.ui, PID: 10065
E/AndroidRuntime(10065): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.yourpackage.ui/com.yourpackage.ui.HomeActivity}: java.lang.ClassNotFoundException: Didn't find class "com.yourpackage.ui.HomeActivity" on path: DexPathList[[zip file "/data/app/com.yourpackage.ui-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.yourpackage.ui-2, /vendor/lib, /system/lib]]
...
You can check Multidex mechanism. The reason may be method numbers overflow.
Add MultiDex.install(this); to your Application:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
and add
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex' // enable multidex
}
}
to your app module's gradle.build
i don't know this will help you..anyway try to use application theme as @style/Theme.AppCompat..we must use as per developers forum.
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>