Hi I have a probelm with my app. Im working on Android Studio 0.8.4
and I get this error:
java.lang.RuntimeException: Unable to instantiate application com.twittstr.TwittstrApplication: java.lang.ClassNotFoundException: Didn't find class "com.twittstr.TwittstrApplication" on path: DexPathList[[zip file "/data/app/com.twittstr-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.twittstr-1, /system/lib]] at android.app.LoadedApk.makeApplication(LoadedApk.java:516) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317) at android.app.ActivityThread.access$1500(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) 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:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.twittstr.TwittstrApplication" on path: DexPathList[[zip file "/data/app/com.twittstr-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.twittstr-1, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:497) at java.lang.ClassLoader.loadClass(ClassLoader.java:457) at android.app.Instrumentation.newApplication(Instrumentation.java:975) at android.app.LoadedApk.makeApplication(LoadedApk.java:511) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317) at android.app.ActivityThread.access$1500(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) 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:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method)
I know that there are already similar questions here on stackoverflow. However, the suggested answer was to make a clean in eclipse or someone has had the wrong package name in the manifest. I could not find one of these problems for my app.
My Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.twittstr">
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="20" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:allowBackup="true"
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:theme="@style/Theme.Twittstr"
android:name="com.twittstr.TwittstrApplication"
>
<activity android:name="com.twittstr.login.LoginActivity"
android:theme="@style/Theme.Twittstr.Login"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
I have included other projects from other locations (not in the gradle project path. My settings.gradle:
include ':app'
project(':dagger').projectDir = new File('~/android/dagger')
My build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'crashlytics'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.twittstr"
minSdkVersion 14
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'LICENSE'
exclude 'NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// wearApp project(':wear')
compile 'com.google.android.gms:play-services-wearable:+'
// Annotation Processing
compile 'com.squareup.dagger:dagger:1.2.2'
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
compile project (':dagger')
// ActionItem
compile 'com.tundem.actionitembadge:library:1.1.0@aar'
compile 'com.balysv:material-menu:1.0.0'
// compile 'com.github.japgolly.android:svg-android:2.0.6'
// Twitter
compile 'org.twitter4j:twitter4j-core:4.0.2'
}
The dependecies can be resloved correctly.
Probably its a Android Studio problem. More likely is that I have a very dumb error in the manifest, but I cant see it. Any suggestions?
com.twittstr.TwittstrApplicationclass and does it extendApplication? - mbmcDidn't find class "com.twittstr.login.LoginActivity" on path. The classes are in the correct packages hierarchy. Android Studio autocompletes the package in the manifest file - sockeqwe