Reputation: 7747
I followed the PhoneGap Getting Started with Android instructions. The only thing that isn't exactly as described in the steps is that I have cordova version 2.1.0. The application builds and installs on my phone, but gives a ClassNotFoundException just after starting.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.phonegaptest/com.example.phonegaptest.MainActivity}: java.lang.ClassNotFoundException: com.example.phonegaptest.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.phonegaptest-2.apk]
The MainActivity is the only class in the application. Why can't it be found?
Update: Here's my manifest:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Upvotes: 3
Views: 1618
Reputation: 1298
i was also facing similar situation after i upgraded to v22, when i added the jar file to the build path it started working
Upvotes: -1
Reputation: 7747
I fixed this, but I don't like the solution. I went into the Eclipse Build Path settings for the project, and checked the boxes to export the three jars the project depends on. This solved the problem. Then I started unchecking them to figure out which one I really needed to do that for, and after unchecking all of the boxes, the program still runs.
Upvotes: 7