need your help!
I am new in Android and for some reason my app stopped working and crashes right on startup.
I am not sure if it is related but I've added maven to the project. Here's the error log:
06-23 14:32:18.380: E/AndroidRuntime(1775): FATAL EXCEPTION: main
06-23 14:32:18.380: E/AndroidRuntime(1775): Process: com.app.test, PID: 1775
06-23 14:32:18.380: E/AndroidRuntime(1775): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.app.test/com.test.activities.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "com.test.activities.SplashActivity" on path: DexPathList[[zip file "/data/app/com.app.test-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
06-23 14:32:18.380: E/AndroidRuntime(1775): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2236)
06-23 14:32:18.380: E/AndroidRuntime(1775): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
06-23 14:32:18.380: E/AndroidRuntime(1775): at android.app.ActivityThread.access$800(ActivityThread.java:151)
06-23 14:32:18.380: E/AndroidRuntime(1775): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
06-23 14:32:18.380: E/AndroidRuntime(1775): at android.os.Handler.dispatchMessage(Handler.java:102)
06-23 14:32:18.380: E/AndroidRuntime(1775): at android.os.Looper.loop(Looper.java:135)
06-23 14:32:18.380: E/AndroidRuntime(1775): at android.app.ActivityThread.main(ActivityThread.java:5257)
06-23 14:32:18.380: E/AndroidRuntime(1775): at java.lang.reflect.Method.invoke(Native Method)
06-23 14:32:18.380: E/AndroidRuntime(1775): at java.lang.reflect.Method.invoke(Method.java:372)
06-23 14:32:18.380: E/AndroidRuntime(1775): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
06-23 14:32:18.380: E/AndroidRuntime(1775): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
06-23 14:32:18.380: E/AndroidRuntime(1775): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.test.activities.SplashActivity" on path: DexPathList[[zip file "/data/app/com.app.test-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
06-23 14:32:18.380: E/AndroidRuntime(1775): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-23 14:32:18.380: E/AndroidRuntime(1775): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-23 14:32:18.380: E/AndroidRuntime(1775): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
06-23 14:32:18.380: E/AndroidRuntime(1775): at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
06-23 14:32:18.380: E/AndroidRuntime(1775): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2226)
06-23 14:32:18.380: E/AndroidRuntime(1775): ... 10 more
06-23 14:32:18.380: E/AndroidRuntime(1775): Suppressed: java.lang.ClassNotFoundException: com.test.activities.SplashActivity
06-23 14:32:18.380: E/AndroidRuntime(1775): at java.lang.Class.classForName(Native Method)
06-23 14:32:18.380: E/AndroidRuntime(1775): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
06-23 14:32:18.380: E/AndroidRuntime(1775): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
06-23 14:32:18.380: E/AndroidRuntime(1775): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
06-23 14:32:18.380: E/AndroidRuntime(1775): ... 13 more
06-23 14:32:18.380: E/AndroidRuntime(1775): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
here's the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="22" />
<uses-permission
android:name = "android.permission.INTERNET"/>
<uses-permission
android:name = "android.permission.BLUETOOTH_ADMIN"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.test.activities.SplashActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.test.activities.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.test.activities.MainMenuActivity"
android:label="@string/title_activity_main_menu" >
</activity>
</application>
and here's the activity:
public class SplashActivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Thread StartTimer = new Thread(){
public void run(){
try {
sleep(2000);
Intent main = new Intent(SplashActivity.this, MainActivity.class);
startActivity(main);
finish(); //kills the current activity
}
catch (InterruptedException ex){}
}
};
StartTimer.start();
}
}
Here is the pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>mockwebserver</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</project>
also here are the build path settings:
Dir structure:
As I know Maven build systems waiting some pathes, check you project, your sources should be located somewhere like:
/src/main/java/com/test in your case.
Is your project have such structure?
And also I recommend to name groupid as "com.test"
https://spring.io/guides/gs/maven-android/