I was adding the Google Cloud Messaging service to my App and altered my manifest file. I get the following StackTrace.
02-27 18:58:11.282: E/AndroidRuntime(988): FATAL EXCEPTION: main
02-27 18:58:11.282: E/AndroidRuntime(988): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.phptest/com.example.phptest.MainActivity}: java.lang.ClassNotFoundException: com.example.phptest.MainActivity
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.access$600(ActivityThread.java:130)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.os.Looper.loop(Looper.java:137)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.main(ActivityThread.java:4745)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 18:58:11.282: E/AndroidRuntime(988): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
02-27 18:58:11.282: E/AndroidRuntime(988): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-27 18:58:11.282: E/AndroidRuntime(988): at dalvik.system.NativeStart.main(Native Method)
02-27 18:58:11.282: E/AndroidRuntime(988): Caused by: java.lang.ClassNotFoundException: com.example.phptest.MainActivity
02-27 18:58:11.282: E/AndroidRuntime(988): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
02-27 18:58:11.282: E/AndroidRuntime(988): ... 11 more
Here is my Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.phptest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<uses-configuration />
<permission
android:name="com.example.phptest.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.phptest.permission.C2D_MESSAGE" />
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.phptest.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>
<service android:name=".GCMIntentService" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.example.phptest" />
</intent-filter>
</receiver>
</application>
</manifest>
MainActivity:
package com.example.phptest;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import com.example.phptest.DeviceLogin.LoginReply;
import com.google.android.gcm.GCMRegistrar;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
public class MainActivity extends Activity implements LoginReply {
String TAG = "Main Activity";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DeviceLogin d = new DeviceLogin(this);
d.execute("xxxx","12345");
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, GCMIntentService.senderId);
} else {
Log.v(TAG, "Already registered");
}
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public static String makeCall(String scriptName) {
String address = "http://10.0.2.2/" + scriptName + ".php";
HttpPost httpPost = new HttpPost(address);
HttpClient httpClient = new DefaultHttpClient();
StringBuilder total = new StringBuilder();
try {
//httpPost.setEntity(new UrlEncodedFormEntity(params));
// Execute HTTP Post Request
HttpResponse response = httpClient.execute(httpPost);
InputStream is = response.getEntity().getContent();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line = "";
// Read response until the end
while ((line = rd.readLine()) != null) {
total.append(line);
}
// Return full string
System.out.println("TOTAL: " + total.toString());
return total.toString();
} catch (Exception e) {
e.printStackTrace();
}
return "empty";
}
public void onDevicesDownloaded(String login) {
// TODO Auto-generated method stub
}
}
Any ideas?
I have seen Android apps get finicky when the full path is specified in the name attribute unless the package the class is in differs from the one you specify at the top of the manifest file. Try changing it to just ".MainActivity" and see if that makes it happy.
Solution was to clean project, D'oh! xD
Related
I have following Android Unity 3D Project file that compiles but fail in runtime with java.lang.RuntimeException: Unable to start activity ComponentInfo java.lang.nullpointerexception.
Here is the UnityPlayerNavtiveActivity.java
package com.sniper.game;
import com.unity3d.player.*;
import android.app.NativeActivity;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
public class UnityPlayerNativeActivity extends NativeActivity
{
protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code
// Setup activity layout
#Override protected void onCreate (Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
getWindow().takeSurface(null);
setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
getWindow().setFormat(PixelFormat.RGBX_8888); // <--- This makes xperia play happy
mUnityPlayer = new UnityPlayer(this);
if (mUnityPlayer.getSettings ().getBoolean ("hide_status_bar", true))
getWindow ().setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(mUnityPlayer);
mUnityPlayer.requestFocus();
}
// Quit Unity
#Override protected void onDestroy ()
{
mUnityPlayer.quit();
super.onDestroy();
}
// Pause Unity
#Override protected void onPause()
{
super.onPause();
mUnityPlayer.pause();
}
// Resume Unity
#Override protected void onResume()
{
super.onResume();
mUnityPlayer.resume();
}
// This ensures the layout will be correct.
#Override public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
mUnityPlayer.configurationChanged(newConfig);
}
// Notify Unity of the focus change.
#Override public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
mUnityPlayer.windowFocusChanged(hasFocus);
}
// For some reason the multiple keyevent type is not supported by the ndk.
// Force event injection by overriding dispatchKeyEvent().
#Override public boolean dispatchKeyEvent(KeyEvent event)
{
if (event.getAction() == KeyEvent.ACTION_MULTIPLE)
return mUnityPlayer.injectEvent(event);
return super.dispatchKeyEvent(event);
}
// Pass any events not handled by (unfocused) views straight to UnityPlayer
#Override public boolean onKeyUp(int keyCode, KeyEvent event) { return mUnityPlayer.injectEvent(event); }
#Override public boolean onKeyDown(int keyCode, KeyEvent event) { return mUnityPlayer.injectEvent(event); }
#Override public boolean onTouchEvent(MotionEvent event) { return mUnityPlayer.injectEvent(event); }
/*API12*/ public boolean onGenericMotionEvent(MotionEvent event) { return mUnityPlayer.injectEvent(event); }
}
Here is UnityPlayerActivity.java:
package com.sniper.game;
import com.unity3d.player.*;
/**
* #deprecated Use UnityPlayerNativeActivity instead.
*/
public class UnityPlayerActivity extends UnityPlayerNativeActivity { }
Here is UnityPlayerProxyActivity.java:
package com.sniper.game;
import com.unity3d.player.*;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
/**
* #deprecated Use UnityPlayerNativeActivity instead.
*/
public class UnityPlayerProxyActivity extends Activity
{
protected void onCreate (Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, com.sniper.game.UnityPlayerNativeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
Bundle extras = getIntent().getExtras();
if (extras != null)
intent.putExtras(extras);
startActivity(intent);
}
}
Here is the AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="5" android:versionName="2.0" package="com.sniper.game" android:installLocation="preferExternal">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
<!-- Google Mobile Ads Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:icon="#drawable/app_icon" android:label="#string/app_name" android:debuggable="false">
<!-- meta-data tag for Google Play services -->
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<activity android:label="#string/app_name" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale" android:name="com.sniper.game.UnityPlayerProxyActivity">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale" android:name="com.sniper.game.UnityPlayerActivity">
</activity>
<activity android:label="#string/app_name" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale" android:name="com.sniper.game.UnityPlayerNativeActivity">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
<activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:label="#string/app_name" android:name="com.unity3d.player.VideoPlayer">
</activity>
<!-- Google Mobile Ads Activity -->
<activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:label="#string/app_name" android:name="com.google.android.gms.ads.AdActivity">
</activity>
</application>
<uses-feature android:glEsVersion="0x00020000" />
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />
<uses-feature android:name="android.hardware.sensor.accelerometer" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
Here is the complete log trace ran few hours later from the screenshot above:
05-15 14:14:03.840: D/AndroidRuntime(1583): Shutting down VM
05-15 14:14:03.840: W/dalvikvm(1583): threadid=1: thread exiting with uncaught exception (group=0xb1ac2b90)
05-15 14:14:03.850: E/AndroidRuntime(1583): FATAL EXCEPTION: main
05-15 14:14:03.850: E/AndroidRuntime(1583): Process: com.sniper.game, PID: 1583
05-15 14:14:03.850: E/AndroidRuntime(1583): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sniper.game/com.sniper.game.UnityPlayerNativeActivity}: java.lang.NullPointerException
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.ActivityThread.access$700(ActivityThread.java:135)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.os.Handler.dispatchMessage(Handler.java:102)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.os.Looper.loop(Looper.java:137)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.ActivityThread.main(ActivityThread.java:4998)
05-15 14:14:03.850: E/AndroidRuntime(1583): at java.lang.reflect.Method.invokeNative(Native Method)
05-15 14:14:03.850: E/AndroidRuntime(1583): at java.lang.reflect.Method.invoke(Method.java:515)
05-15 14:14:03.850: E/AndroidRuntime(1583): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
05-15 14:14:03.850: E/AndroidRuntime(1583): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
05-15 14:14:03.850: E/AndroidRuntime(1583): at dalvik.system.NativeStart.main(Native Method)
05-15 14:14:03.850: E/AndroidRuntime(1583): Caused by: java.lang.NullPointerException
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.os.Parcel.readException(Parcel.java:1467)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.os.Parcel.readException(Parcel.java:1415)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.os.storage.IMountService$Stub$Proxy.mkdirs(IMountService.java:750)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.ContextImpl.ensureDirsExistOrFilter(ContextImpl.java:2160)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.ContextImpl.getObbDirs(ContextImpl.java:874)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.ContextImpl.getObbDir(ContextImpl.java:863)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.content.ContextWrapper.getObbDir(ContextWrapper.java:220)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.NativeActivity.onCreate(NativeActivity.java:177)
05-15 14:14:03.850: E/AndroidRuntime(1583): at com.sniper.game.UnityPlayerNativeActivity.onCreate(UnityPlayerNativeActivity.java:22)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.Activity.performCreate(Activity.java:5243)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-15 14:14:03.850: E/AndroidRuntime(1583): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
05-15 14:14:03.850: E/AndroidRuntime(1583): ... 11 more
I need help in getting this Unity3D Android game running on simulator and then download and run on actual device.
I try to implement an application based on rscm (middleware). When I try to run on emulator, I get the errors listed below:
Error :03-27 16:58:20.490: E/Trace(1508): error opening trace file: No
such file or directory (2)
03-27 21:53:21.610: D/AndroidRuntime(3803): Shutting down VM 03-27
21:53:21.610: W/dalvikvm(3803): threadid=1: thread exiting with
uncaught exception (group=0x40a71930) 03-27 21:53:21.760:
E/AndroidRuntime(3803): FATAL EXCEPTION: main 03-27 21:53:21.760:
E/AndroidRuntime(3803): java.lang.RuntimeException: Unable to
instantiate activity
ComponentInfo{com.example.context_application/com.example.context_application.MyContextAwareActivity}:
java.lang.ClassNotFoundException: Didn't find class
"com.example.context_application.MyContextAwareActivity" on path:
/data/app/com.example.context_application-2.apk 03-27 21:53:21.760:
E/AndroidRuntime(3803): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
android.app.ActivityThread.access$600(ActivityThread.java:141) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
android.os.Handler.dispatchMessage(Handler.java:99) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
android.os.Looper.loop(Looper.java:137) 03-27 21:53:21.760:
E/AndroidRuntime(3803): at
android.app.ActivityThread.main(ActivityThread.java:5041) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
java.lang.reflect.Method.invokeNative(Native Method) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
java.lang.reflect.Method.invoke(Method.java:511) 03-27 21:53:21.760:
E/AndroidRuntime(3803): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
dalvik.system.NativeStart.main(Native Method) 03-27 21:53:21.760:
E/AndroidRuntime(3803): Caused by: java.lang.ClassNotFoundException:
Didn't find class
"com.example.context_application.MyContextAwareActivity" on path:
/data/app/com.example.context_application-2.apk 03-27 21:53:21.760:
E/AndroidRuntime(3803): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
java.lang.ClassLoader.loadClass(ClassLoader.java:501) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
java.lang.ClassLoader.loadClass(ClassLoader.java:461) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
android.app.Instrumentation.newActivity(Instrumentation.java:1054)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
03-27 21:53:21.760: E/AndroidRuntime(3803): ... 11 more
Can anyone help?
package com.example.context;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import org.aspectsense.rscm.ContextValue;
import org.aspectsense.rscm.context.client.ContextListenerActivity;
import org.json.JSONException;
import java.util.Date;
public class MyContextAwareActivity extends ContextListenerActivity
{
#Override public String[] getRequestedScopes()
{
return new String[] { "battery.level" };
}
private TextView messageTextView;
#Override protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
messageTextView = new TextView(this);
setContentView(messageTextView);
appendMessage("Activity created");
}
private void appendMessage(final String message)
{
final String currentMessage = messageTextView.getText().toString();
messageTextView.setText(currentMessage + "\n" + message);
}
#Override public void onContextValueChanged(ContextValue contextValue)
{
try
{
appendMessage(new Date() + ": The battery level is " + contextValue.getValueAsInteger() + "%");
}
catch (JSONException jsone)
{
Toast.makeText(this, "Error while displaying context event: " + contextValue, Toast.LENGTH_SHORT).show();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.context"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.context.MyContextAwareActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
You are telling it to write to external storage. Have you set up an SD card in eclipse?
Do any of these answers help? error opening trace file: No such file or directory (2)
I searched a lot for similar kind of error, but I am not getting a solution for it. I am getting this error as soon as I start the app
03-21 10:33:08.100: E/AndroidRuntime(13098): FATAL EXCEPTION: main
03-21 10:33:08.100: E/AndroidRuntime(13098): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.airlife/com.example.airlife.MainActivity}: java.lang.ClassNotFoundException: com.example.airlife.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.airlife-2.apk]
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.access$1500(ActivityThread.java:135)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.os.Looper.loop(Looper.java:150)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.main(ActivityThread.java:4389)
03-21 10:33:08.100: E/AndroidRuntime(13098): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 10:33:08.100: E/AndroidRuntime(13098): at java.lang.reflect.Method.invoke(Method.java:507)
03-21 10:33:08.100: E/AndroidRuntime(13098): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
03-21 10:33:08.100: E/AndroidRuntime(13098): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
03-21 10:33:08.100: E/AndroidRuntime(13098): at dalvik.system.NativeStart.main(Native Method)
03-21 10:33:08.100: E/AndroidRuntime(13098): Caused by: java.lang.ClassNotFoundException: com.example.airlife.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.airlife-2.apk]
03-21 10:33:08.100: E/AndroidRuntime(13098): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
03-21 10:33:08.100: E/AndroidRuntime(13098): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
03-21 10:33:08.100: E/AndroidRuntime(13098): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.Instrumentation.newActivity(Instrumentation.java:1040)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1777)
03-21 10:33:08.100: E/AndroidRuntime(13098): ... 11 more
MainActivity.java is like this
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import android.os.Bundle;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
public class MainActivity extends MapActivity implements OnClickListener{
private ImageButton mVid,mAgebtn,mWeightbtn,mPicbtn,mMsgbtn,mReqbtn,mHelibtn,mDocbtn,mContextbtn;
private MapView mapView;
private MyLocationOverlay myLocationOverlay;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView = (MapView)findViewById(R.id.webview);
mapView.setBuiltInZoomControls(true);
myLocationOverlay = new MyLocationOverlay(this, mapView);
mapView.getOverlays().add(myLocationOverlay);
mapView.postInvalidate();
// call convenience method that zooms map on our location
zoomToMyLocation();
mAgebtn = (ImageButton) findViewById(R.id.imageView36);
mWeightbtn = (ImageButton) findViewById(R.id.imageView4);
mPicbtn = (ImageButton) findViewById(R.id.imageView5);
mMsgbtn = (ImageButton) findViewById(R.id.imageView6);
mReqbtn = (ImageButton) findViewById(R.id.imageView32);
mHelibtn = (ImageButton) findViewById(R.id.btnsearch);
mDocbtn = (ImageButton) findViewById(R.id.btnprovide);
mVid = (ImageButton) findViewById(R.id.btnpost);
mContextbtn = (ImageButton) findViewById(R.id.btnsettings);
mAgebtn.setOnClickListener(this);
mWeightbtn.setOnClickListener(this);
mPicbtn.setOnClickListener(this);
mMsgbtn.setOnClickListener(this);
mReqbtn.setOnClickListener(this);
mHelibtn.setOnClickListener(this);
mDocbtn.setOnClickListener(this);
mVid.setOnClickListener(this);
mContextbtn.setOnClickListener(this);
}
#Override
protected void onResume() {
super.onResume();
// when our activity resumes, we want to register for location updates
myLocationOverlay.enableMyLocation();
}
#Override
protected void onPause() {
super.onPause();
// when our activity pauses, we want to remove listening for location updates
myLocationOverlay.disableMyLocation();
}
/**
* This method zooms to the user's location with a zoom level of 10.
*/
private void zoomToMyLocation() {
GeoPoint myLocationGeoPoint = myLocationOverlay.getMyLocation();
if(myLocationGeoPoint != null) {
mapView.getController().animateTo(myLocationGeoPoint);
mapView.getController().setZoom(10);
}
else {
Toast.makeText(this, "Cannot determine location", Toast.LENGTH_SHORT).show();
}
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.airlife"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.airlife.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>
<activity android:name=".playvid" />
<activity android:name=".Display" />
<activity android:name=".Video" />
<activity android:name=".Documents" />
<activity android:name=".Contact" />
<activity android:name=".FixedMyLocationOverlay" />
</application>
</manifest>
Please tell me why I am getting this error, and how to solve this.
Got the solution. I had missed this code in my manifest file
<uses-library android:name="com.google.android.maps"/>
Class not found exception in MainActivity.
I think you've the wrong package, or that your APK doesn't have what you think it has.This is your package name.
com.example.airlife
Maku sure that it is imported in all activities as.
package com.example.airlife;
and don't forget to add entry in manifest file for every new activity.
If so, then make this change in manifest file. No need to mention your package name and remove allowBackUp
<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>
if not this try adding any library files you are using. missing library files may also cause this exception. see this link
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo after SDK update
I am new to android application and i am getting classNotFound exception while running android application.
i pasted logcat,manifest file and java code.
can anyone know the cause of the problem?
LogCat:-
02-25 12:10:20.071: W/dalvikvm(273): Unable to resolve superclass of Lcom/phonegap/plugins/downloader/MainActivity; (35)
02-25 12:10:20.071: W/dalvikvm(273): Link of class 'Lcom/phonegap/plugins/downloader/MainActivity;' failed
02-25 12:10:20.071: D/AndroidRuntime(273): Shutting down VM
02-25 12:10:20.071: W/dalvikvm(273): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
02-25 12:10:20.101: E/AndroidRuntime(273): FATAL EXCEPTION: main
02-25 12:10:20.101: E/AndroidRuntime(273): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.phonegap.plugins.downloader/com.phonegap.plugins.downloader.MainActivity}: java.lang.ClassNotFoundException: com.phonegap.plugins.downloader.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.phonegap.plugins.downloader-1.apk]
02-25 12:10:20.101: E/AndroidRuntime(273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
02-25 12:10:20.101: E/AndroidRuntime(273): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-25 12:10:20.101: E/AndroidRuntime(273): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-25 12:10:20.101: E/AndroidRuntime(273): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-25 12:10:20.101: E/AndroidRuntime(273): at android.os.Handler.dispatchMessage(Handler.java:99)
02-25 12:10:20.101: E/AndroidRuntime(273): at android.os.Looper.loop(Looper.java:123)
02-25 12:10:20.101: E/AndroidRuntime(273): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-25 12:10:20.101: E/AndroidRuntime(273): at java.lang.reflect.Method.invokeNative(Native Method)
02-25 12:10:20.101: E/AndroidRuntime(273): at java.lang.reflect.Method.invoke(Method.java:521)
02-25 12:10:20.101: E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-25 12:10:20.101: E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-25 12:10:20.101: E/AndroidRuntime(273): at dalvik.system.NativeStart.main(Native Method)
02-25 12:10:20.101: E/AndroidRuntime(273): Caused by: java.lang.ClassNotFoundException: com.phonegap.plugins.downloader.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.phonegap.plugins.downloader-1.apk]
02-25 12:10:20.101: E/AndroidRuntime(273): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
02-25 12:10:20.101: E/AndroidRuntime(273): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
02-25 12:10:20.101: E/AndroidRuntime(273): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
02-25 12:10:20.101: E/AndroidRuntime(273): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
02-25 12:10:20.101: E/AndroidRuntime(273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
JavaCode:-
package com.phonegap.plugins.downloader;
import org.apache.cordova.DroidGap;
import android.os.Bundle;
public class MainActivity extends DroidGap {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/download/download.html");
}
}
Manifest File:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.phonegap.plugins.downloader"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<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:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.phonegap.plugins.downloader.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>
<activity android:name="com.phonegap.plugins.downloader.Downloader" />
</application>
</manifest>
Downloader.java
package com.phonegap.plugins.downloader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.util.Log;
import android.os.Environment;
import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
public class Downloader extends Plugin {
#Override
public PluginResult execute(String action, JSONArray args, String callbackId) {
if (!action.equals("downloadFile"))
return new PluginResult(PluginResult.Status.INVALID_ACTION);
try {
String fileUrl = args.getString(0);
JSONObject params = args.getJSONObject(1);
String fileName = params.has("fileName") ?
params.getString("fileName"):
fileUrl.substring(fileUrl.lastIndexOf("/")+1);
String dirName = params.has("dirName") ?
params.getString("dirName"):
Environment.getExternalStorageDirectory().getPath() + "/download";
Boolean overwrite = params.has("overwrite") ? params.getBoolean("overwrite") : false;
return this.downloadUrl(fileUrl, dirName, fileName, overwrite, callbackId);
} catch (JSONException e) {
e.printStackTrace();
return new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
} catch (InterruptedException e) {
e.printStackTrace();
return new PluginResult(PluginResult.Status.ERROR, e.getMessage());
}
}
private PluginResult downloadUrl(String fileUrl, String dirName, String fileName, Boolean overwrite, String callbackId) throws InterruptedException, JSONException {
try {
Log.d("PhoneGapLog", "Downloading "+fileUrl + " into " + dirName + "/" + fileName);
File dir = new File(dirName);
if (!dir.exists()) {
Log.d("PhoneGapLog", "directory " + dirName + " created");
dir.mkdirs();
}
File file = new File(dirName, fileName);
if (!overwrite && file.exists()) {
Log.d("DownloaderPlugin", "File already exist");
JSONObject obj = new JSONObject();
obj.put("status", 1);
obj.put("total", 0);
obj.put("file", fileName);
obj.put("dir", dirName);
obj.put("progress", 100);
return new PluginResult(PluginResult.Status.OK, obj);
}
URL url = new URL(fileUrl);
HttpURLConnection ucon = (HttpURLConnection) url.openConnection();
ucon.setRequestMethod("GET");
ucon.connect();
Log.d("PhoneGapLog", "Download start");
InputStream is = ucon.getInputStream();
byte[] buffer = new byte[1024];
int readed = 0,
progress = 0,
totalReaded = 0,
fileSize = ucon.getContentLength();
FileOutputStream fos = new FileOutputStream(file);
while ((readed = is.read(buffer)) > 0) {
fos.write(buffer, 0, readed);
totalReaded += readed;
int newProgress = (totalReaded*100/fileSize);
if (newProgress != progress)
progress = informProgress(fileSize, newProgress, dirName, fileName, callbackId);
}
fos.close();
Log.d("PhoneGapLog", "Download finished");
JSONObject obj = new JSONObject();
obj.put("status", 1);
obj.put("total", fileSize);
obj.put("file", fileName);
obj.put("dir", dirName);
obj.put("progress", progress);
return new PluginResult(PluginResult.Status.OK, obj);
}
catch (FileNotFoundException e) {
Log.d("PhoneGapLog", "File Not Found: " + e);
return new PluginResult(PluginResult.Status.ERROR, 404);
}
catch (IOException e) {
Log.d("PhoneGapLog", "Error: " + e);
return new PluginResult(PluginResult.Status.ERROR, e.getMessage());
}
}
private int informProgress(int fileSize, int progress, String dirName, String fileName, String callbackId) throws InterruptedException, JSONException {
JSONObject obj = new JSONObject();
obj.put("status", 0);
obj.put("total", fileSize);
obj.put("file", fileName);
obj.put("dir", dirName);
obj.put("progress", progress);
PluginResult res = new PluginResult(PluginResult.Status.OK, obj);
res.setKeepCallback(true);
success(res, callbackId);
//Give a chance for the progress to be sent to javascript
Thread.sleep(100);
return progress;
}
}
Check for your java build path for the correct Lib for Phonegap
If you are using eclipse, add cordova-XXX.jar to java build path and remember to check the box next to cordova-XXX.jar in the "Order and Export" tab.
I have viewed most of the other threads regarding this error but have not found an answer.
I started a new project a couple of weeks ago using a plugin and the example project with the plugin. Added various of my own features and designs and no problems running the project.
Then updated to ADT 17 2 days ago and this seriously messed things up for me. Started getting class path errors to name a few. I then reverted back to adt 16 which fixed the errors and my project compiles fine but as soon as i run it it crashes on the test device.
I have checked that my compliance level is correct, checked library paths, api versions, manifest xml, basically everything. I do not get how something that use to work perfectly can now just not work.
I proceeded to unistall everything and did a reinstall on the sdk's ADT and java, but to no avail, even just trying to run the example project just crashes.
I have aslo uninstalled the app from the device and rbooted the device and cleared the cache. I am at the end of my rope. Like i say, i have checked libraries and everything, its just this runtime error.
I also increased the connection time out, and added "android:installLocation="preferExternal" to my manifest, no change.
Please help, there cant be an issue with the code as it worked perfectly.
Please see the code for the starting activity:
package com.yourcompany.junaioplugin.template;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import com.yourcompany.junaioplugin.template.R;
import com.metaio.junaio.plugin.JunaioPlugin;
public class SplashActivity extends Activity
{
static
{
JunaioPlugin.loadNativeLibs();
}
/**
* standard tag used for all the debug messages
*/
public static final String TAG = "junaioPluginTemplate";
/**
* Display log messages with debug priority
*
* #param msg Message to display
* #see Log#d(String, String)
*/
public static void log(String msg)
{
if (msg != null)
Log.d(TAG, msg);
}
/**
* Progress dialog
*/
private ProgressDialog progressDialog;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView( R.layout.main );
JunaioStarterTask junaioStarter = new JunaioStarterTask();
junaioStarter.execute(1);
}
private class JunaioStarterTask extends AsyncTask<Integer, Integer, Integer>
{
#Override
protected void onPreExecute()
{
progressDialog = ProgressDialog.show(SplashActivity.this, "junaio", "Starting up...");
}
#Override
protected Integer doInBackground(Integer... params)
{
// Set authentication if a private channel is used
// JunaioPlugin.setAuthentication("username", "password");
// Start junaio, this will initialize everything the plugin need
int result = JunaioPlugin.startJunaio(this, getApplicationContext());
return result;
}
#Override
protected void onProgressUpdate(Integer... progress)
{
}
#Override
protected void onPostExecute(Integer result)
{
if (progressDialog != null)
{
progressDialog.cancel();
progressDialog = null;
}
switch (result)
{
case JunaioPlugin.ERROR_EXSTORAGE:
SplashActivity.log("External storage is not available, closing...");
finish();
break;
case JunaioPlugin.ERROR_INSTORAGE:
SplashActivity.log("Internal storage is not available, closing...");
finish();
break;
case JunaioPlugin.CANCELLED:
SplashActivity.log("Starting junaio cancelled");
break;
case JunaioPlugin.SUCCESS:
JunaioPlugin.setAuthentication("junaioTester", "test123");
launchLiveView();
break;
}
}
}
/**
* Launch junaio live view
*/
private void launchLiveView()
{
startActivity(new Intent(this, JunaioARViewTestActivity.class));
finish();
}
#Override
protected void onResume()
{
super.onResume();
}
#Override
protected void onPause()
{
super.onPause();
}
#Override
protected void onStop()
{
super.onStop();
if (progressDialog != null)
{
progressDialog.cancel();
progressDialog = null;
}
}
}
Here is the logcat:
03-27 10:47:47.543: I/dalvikvm(10641): Could not find method com.metaio.junaio.plugin.JunaioPlugin.loadNativeLibs, referenced from method com.yourcompany.junaioplugin.template.SplashActivity.<clinit>
03-27 10:47:47.543: W/dalvikvm(10641): VFY: unable to resolve static method 65: Lcom/metaio/junaio/plugin/JunaioPlugin;.loadNativeLibs ()V
03-27 10:47:47.543: D/dalvikvm(10641): VFY: replacing opcode 0x71 at 0x0000
03-27 10:47:47.543: D/dalvikvm(10641): VFY: dead code 0x0003-0003 in Lcom/yourcompany/junaioplugin/template/SplashActivity;.<clinit> ()V
03-27 10:47:47.543: W/dalvikvm(10641): Unable to resolve superclass of Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity; (48)
03-27 10:47:47.543: W/dalvikvm(10641): Link of class 'Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity;' failed
03-27 10:47:47.547: E/dalvikvm(10641): Could not find class 'com.yourcompany.junaioplugin.template.JunaioARViewTestActivity', referenced from method com.yourcompany.junaioplugin.template.SplashActivity.launchLiveView
03-27 10:47:47.547: W/dalvikvm(10641): VFY: unable to resolve const-class 78 (Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity;) in Lcom/yourcompany/junaioplugin/template/SplashActivity;
03-27 10:47:47.547: D/dalvikvm(10641): VFY: replacing opcode 0x1c at 0x0002
03-27 10:47:47.547: D/dalvikvm(10641): VFY: dead code 0x0004-000d in Lcom/yourcompany/junaioplugin/template/SplashActivity;.launchLiveView ()V
03-27 10:47:47.547: W/dalvikvm(10641): Exception Ljava/lang/NoClassDefFoundError; thrown during Lcom/yourcompany/junaioplugin/template/SplashActivity;.<clinit>
03-27 10:47:47.547: W/dalvikvm(10641): Class init failed in newInstance call (Lcom/yourcompany/junaioplugin/template/SplashActivity;)
03-27 10:47:47.547: D/AndroidRuntime(10641): Shutting down VM
03-27 10:47:47.547: W/dalvikvm(10641): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
03-27 10:47:47.555: E/AndroidRuntime(10641): FATAL EXCEPTION: main
03-27 10:47:47.555: E/AndroidRuntime(10641): java.lang.ExceptionInInitializerError
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.Class.newInstanceImpl(Native Method)
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.Class.newInstance(Class.java:1429)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.os.Handler.dispatchMessage(Handler.java:99)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.os.Looper.loop(Looper.java:123)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.reflect.Method.invokeNative(Native Method)
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.reflect.Method.invoke(Method.java:521)
03-27 10:47:47.555: E/AndroidRuntime(10641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
03-27 10:47:47.555: E/AndroidRuntime(10641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-27 10:47:47.555: E/AndroidRuntime(10641): at dalvik.system.NativeStart.main(Native Method)
03-27 10:47:47.555: E/AndroidRuntime(10641): Caused by: java.lang.NoClassDefFoundError: com.metaio.junaio.plugin.JunaioPlugin
03-27 10:47:47.555: E/AndroidRuntime(10641): at com.yourcompany.junaioplugin.template.SplashActivity.<clinit>(SplashActivity.java:19)
03-27 10:47:47.555: E/AndroidRuntime(10641): ... 15 more
Here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="3"
android:versionName="3.5.1" package="com.yourcompany.junaioplugin.template"
android:installLocation="preferExternal">
<!-- The application must be compiled using Google APIs (Android 3.0) -->
<!-- However, target and min SDK can be 8 (Android 2.2) -->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false"/>
<uses-feature android:name="android.hardware.sensor.compass" android:required="false"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<application
android:label="#string/app_name"
android:icon="#drawable/icon"
android:debuggable="true">
<uses-library android:name="com.google.android.maps" />
<!-- Start screen -->
<activity android:name=".SplashActivity"
android:theme="#style/Theme.Fullscreen"
android:screenOrientation="portrait"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- junaio AR view activity -->
<activity
android:name=".JunaioARViewTestActivity"
android:theme="#style/Theme.Fullscreen"
android:configChanges="orientation"
android:screenOrientation="landscape">
</activity>
<activity
android:name="com.metaio.junaio.plugin.view.POIDetailDialog"
android:theme="#style/Theme.POIDialog"
android:screenOrientation="landscape">
</activity>
<activity
android:name="com.metaio.junaio.plugin.view.WebViewActivity"
android:theme="#style/Theme.Fullscreen"
android:configChanges="orientation">"
</activity>
<activity
android:name="com.metaio.junaio.plugin.view.ImageViewActivity"
android:theme="#style/Theme.Fullscreen"
android:configChanges="orientation">
</activity>
</application>
</manifest>
For me, when I installed ADT 17 I have problems using 3rd party libraries (It kept telling me there were duplications). It turns out that they no longer need to be added to the build path; just kept in a folder in the root of your project called "libs". Could this be the same problem?