Can't find class MainActivity (imported project)
android, eclipse, import, java, logcat
Solution
Problem solved!!
The entire problem was caused by Google Play Services library project. When someone sent me this project, he also attached all three library projects needed for the project. I then added all three library project directly from the file that he sent me.
Now the thing is, you always need to add google play services from SDK download location (not from anywhere else - external sources), so I just removed the current google play services and added the ones that I downloadad with the SDK manager and the problem was solved.
Problem
So I imported an android project and after struggling for a while when I was finally done, I compiled the app and it crashed. This is the logcat file: ``` 07-16 23:02:23.700: E/AndroidRuntime(23092): FATAL EXCEPTION: main 07-16 23:02:23.700: E/AndroidRuntime(23092): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{si.dvanadva.evanturist/si.dvanadva.evanturist.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "si.dvanadva.evanturist.MainActivity" on path: /data/app/si.dvanadva.evanturist-2.apk 07-16 23:02:23.700: E/AndroidRuntime(23092): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) 07-16 23:02:23.700: E/AndroidRuntime(23092): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 07-16 23:02:23.700: E/AndroidRuntime(23092): at android.app.ActivityThread.access$600(ActivityThread.java:141) 07-16 23:02:23.700: E/AndroidRuntime(23092): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 07-16 23:02:23.700: E/AndroidRuntime(23092): at android.os.Handler.dispatchMessage(Handler.java:99) 07-16 23:02:23.700: E/AndroidRuntime(23092): at android.os.Looper.loop(Looper.java:137) 07-16 23:02:23.700: E/AndroidRuntime(23092): at android.app.ActivityThread.main(ActivityThread.java:5041) 07-16 23:02:23.700: E/AndroidRuntime(23092): at java.lang.reflect.Method.invokeNative(Native Method) 07-16 23:02:23.700: E/AndroidRuntime(23092): at java.lang.reflect.Method.invoke(Method.java:511) 07-16 23:02:23.700: E/AndroidRuntime(23092): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 07-16 23:02:23.700: E/AndroidRuntime(23092): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 07-16 23:02:23.700: E/AndroidRuntime(23092): at dalvik.system.NativeStart.main(Native Method) 07-16 23:02:23.700: E/AndroidRuntime(23092): Caused by: java.lang.ClassNotFoundException: Didn't find class "si.dvanadva.evanturist.MainActivity" on path: /data/app/si.dvanadva.evanturist-2.apk 07-16 23:02:23.700: E/AndroidRuntime(23092): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) 07-16 23:02:23.700: E/AndroidRuntime(23092): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 07-16 23:02:23.700: E/AndroidRuntime(23092): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 07-16 23:02:23.700: E/AndroidRuntime(23092): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 07-16 23:02:23.700: E/AndroidRuntime(23092): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) ``` I can see from this line: ``` 07-16 23:02:23.700: E/AndroidRuntime(23092): Caused by: java.lang.ClassNotFoundException: Didn't find class "si.dvanadva.evanturist.MainActivity" on path: /data/app/si.dvanadva.evanturist-2.apk ``` That there is a problem finding MainActivity class. But why? This is how I imported the project: Imported raw project (without libraries) Added jars to libs folder in the project Added missing build path for jars Imported three library projects (the original project detected them) Those three library projects are all in the same folder as the original project (in case I placed them wrong or something) If you need any additional info please let me know, I need to solve this problem Packages and their content: AndroidManifest full code: ``` <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="si.dvanadva.evanturist" android:versionCode="7" android:versionName="1.1.2" android:installLocation="preferExternal"> <!-- ZA MAPE --> <permission android:name="com.dd.evanturist.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="com.dd.evanturist.permission.MAPS_RECEIVE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <!-- External storage for caching. --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <!-- My Location --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <!-- Maps API needs OpenGL ES 2.0. --> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <!-- End of copy. --> <!-- QR STUFF --> <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.FLASHLIGHT"/> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <application android:allowBackup="true" android:name=".MyApplication" android:icon="@drawable/ic_launcher" android:label="@string/evanturist" android:theme="@style/AppTheme" > <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyDK5zGCwh3awW08BOAwupjU4hw8750WuLM"/> <activity android:name=".MainActivity" android:label="@string/evanturist" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".DBActivity"></activity> <activity android:name=".DbTestActivity"></activity> <activity android:name=".PlaceItemActivity"></activity> <activity android:name=".CheckpointsActivity"></activity> <activity android:name=".OptionsActivity"></activity> <activity android:name=".MapDirectionsActivity"></activity> <activity android:name=".VictoryActivity"></activity> <activity android:name=".QrActivity" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> <activity android:name=".QrPortraitActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar"></activity> </application> ``` Export tab at build paths: