java.lang.IllegalAccessError classe ref dans preverified classe résolu à l'inattendu de la mise en œuvre

Im obtenir une "java.lang.IllegalAccessError classe ref dans preverified classe résolu à l'inattendu de la mise en œuvre" d'erreur lorsque que j'appuie sur un bouton qui lance une méthode dans MainActivity qui est censé commencer une nouvelle Activité. Que puis-je faire pour résoudre ce problème? Ceci est ma première tentative de faire une application android, donc jaurai besoin des instructions étape par étape 🙂

Aussi que je n'ai pas pu tester si elle fonctionne encore, mais si vous remarquez quelque chose de mal avec mon AugiActivity service de la mise en œuvre ou la diffusion locale de la mise en œuvre hésitez pas à me le faire savoir.

Merci!

fyi: MainActivity commence la Navigation de l'Activité, qui démarre Service AugiActivity

Augi activité envoie locale la diffusion de messages à la Navigation

LogCat:

03-24 20:01:56.632: E/AndroidRuntime(11183): FATAL EXCEPTION: main
03-24 20:01:56.632: E/AndroidRuntime(11183): java.lang.IllegalStateException: Could not     
execute method of the activity
03-24 20:01:56.632: E/AndroidRuntime(11183): at 
android.view.View$1.onClick(View.java:2154)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
android.view.View.performClick(View.java:2537)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
android.view.View$PerformClick.run(View.java:9157)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
android.os.Handler.handleCallback(Handler.java:587)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
android.os.Handler.dispatchMessage(Handler.java:92)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
android.os.Looper.loop(Looper.java:130)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at   
android.app.ActivityThread.main(ActivityThread.java:3687)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at   
java.lang.reflect.Method.invokeNative(Native Method)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at   
java.lang.reflect.Method.invoke(Method.java:507)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at   
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at   
dalvik.system.NativeStart.main(Native Method)
03-24 20:01:56.632: E/AndroidRuntime(11183): Caused by:   
java.lang.reflect.InvocationTargetException
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
java.lang.reflect.Method.invokeNative(Native Method)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
java.lang.reflect.Method.invoke(Method.java:507)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
android.view.View$1.onClick(View.java:2149)
03-24 20:01:56.632: E/AndroidRuntime(11183):    ... 11 more
03-24 20:01:56.632: E/AndroidRuntime(11183): Caused by: java.lang.NoClassDefFoundError: 
com.example.augi_practice.Navigation
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
com.example.augi_practice.MainActivity.navigation(MainActivity.java:33)
03-24 20:01:56.632: E/AndroidRuntime(11183):    ... 14 more
03-24 20:01:56.632: E/AndroidRuntime(11183): Caused by: java.lang.IllegalAccessError: 
Class ref in pre-verified class resolved to unexpected implementation
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
dalvik.system.DexFile.defineClass(Native Method)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
dalvik.system.DexFile.loadClassBinaryName(DexFile.java:207)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:200)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
03-24 20:01:56.632: E/AndroidRuntime(11183):    at 
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-24 20:01:56.632: E/AndroidRuntime(11183):    ... 15 more

Fichier XML:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.augi_practice"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.augi_practice.MainActivity"
android:label="@string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"   
/>
</intent-filter>
</activity>
<activity
android:name="com.example.augi_practice.Navigation"
android:label="@string/title_activity_navigation" 
android:screenOrientation="landscape" >
</activity>
<service
android:name="com.example.augi_practice.AugiActivity"
android:label="@string/title_activity_augi"
android:parentActivityName="com.example.augi_practice.Navigation"
android:screenOrientation="landscape" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.augi_practice.Navigation" />            
</service>       
<uses-library android:name="com.google.android.maps" />    
</application>
</manifest>

Activité Principale:

package com.example.augi_practice;
import ioio.lib.util.android.IOIOActivity;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@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 void call_ioio(View v)
{   
Intent intent = new Intent(this, AugiActivity.class);
startActivity(intent);
}
public void navigation(View v)
{   
Intent intent = new Intent(this, Navigation.class);
startActivity(intent);
}
}

De Navigation De L'Activité:

package com.example.augi_practice;
//Lots of imports here
public class Navigation extends MapActivity implements Runnable,   
SurfaceHolder.Callback{
String LED = null;
String MAG = null;
String BAR = null;
String GYRO = null;
String EULER = null;    
String GGA = null;
private BroadcastReceiver MessageReceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context context, Intent intent)
{
LED = intent.getStringExtra("LED");
MAG = intent.getStringExtra("MAG");
BAR = intent.getStringExtra("BAR");
GYRO = intent.getStringExtra("GYRO");
EULER = intent.getStringExtra("EULER");
GGA = intent.getStringExtra("GGA");         
}
};
//More global variables
//Lots of gui variables here
//More global variables
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation);
MapView mapview = (MapView) findViewById(R.id.mapview);
mapview.setBuiltInZoomControls(true);   
getWindow().setFormat(PixelFormat.UNKNOWN);
//Camera configuration settings
LocalBroadcastManager.getInstance(this).registerReceiver(MessageReceiver, 
new IntentFilter("IOIOData"));
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
//Lots of links from acivity to gui 
startService( new Intent(this, AugiActivity.class));        
}
@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_navigation, menu);
return true;
}
@Override
protected boolean isRouteDisplayed() {
//TODO Auto-generated method stub
return false;
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
//TODO Auto-generated method stub
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
//TODO Auto-generated method stub
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
//TODO Auto-generated method stub
}
public void sensorLayer(View v)
{
//Executes some code
}
public void mapLayer(View v)
{
//Executes some code
}
public void cameraLayer(View v)
{
//Executes some code
}   
@Override
public void run() {
//Executes some code
}   
}

Partie de AugiActivity:

package com.example.augi_practice;
//lots of imports here
public class AugiActivity extends Service { 
public Activity activity_name;
class IOIO extends IOIOActivity {   
//Lots of global variables
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); 
activity_name = this.getParent();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//Inflate the menu; this adds items to the action bar if it is present.        
return true;
}
class Looper extends BaseIOIOLooper {
/** The on-board LED. */
//Class variables
public Activity activity_name;
Looper(Activity x)
{
this.activity_name = x;
}       
//More class variables
/**
* Called every time a connection with IOIO has been established.
* Typically used to open pins.
*   
* @throws ConnectionLostException
*             When IOIO connection is lost.
* @throws InterruptedException 
* 
* @see ioio.lib.util.AbstractIOIOActivity.IOIOThread#setup()
*/
@Override
protected void setup() throws ConnectionLostException, 
InterruptedException 
{
//establish various connections here
bar_calibration();      
mag_setup();
imu_setup();    
try {
gps_setup();
} catch (IOException e) {
//TODO Auto-generated catch block
e.printStackTrace();
}
}
//Various setup methods here
/**
* Called repetitively while the IOIO is connected.
* 
* @throws ConnectionLostException
*             When IOIO connection is lost.
* @throws InterruptedException 
* 
* @see ioio.lib.util.AbstractIOIOActivity.IOIOThread#loop()
*/
@Override
public void loop() throws ConnectionLostException, 
InterruptedException 
{           
get_light();
get_temp();
get_pressure();
get_north();
get_imu();
try {
get_gps();
} catch (IOException e) {
//TODO Auto-generated catch block
e.printStackTrace();
}
led_.write(true);   
sendMessage();
}
//Various methodes to get data
private void sendMessage()
{
Intent intent = new Intent("IOIOData");     
intent.putExtra("LED", get_LED());
LocalBroadcastManager.getInstance(activity_name).sendBroadcast(intent);
intent.putExtra("MAG", get_MAG());
LocalBroadcastManager.getInstance(activity_name).sendBroadcast(intent);
intent.putExtra("BAR", get_BAR());
LocalBroadcastManager.getInstance(activity_name).sendBroadcast(intent);
intent.putExtra("GYRO", get_GYRO());
LocalBroadcastManager.getInstance(activity_name).sendBroadcast(intent);
intent.putExtra("EULER", get_EULER());
LocalBroadcastManager.getInstance(activity_name).sendBroadcast(intent);
intent.putExtra("GGA", gps_GGA);
LocalBroadcastManager.getInstance(activity_name).sendBroadcast(intent);
}
}
Voir ceci et ceci
essayez de mettre à jour Intent intent = new Intent(this, Navigation.class); Intent intent = new Intent(getcontexteapplication(), Navigation.class); startActivity(intent);
J'ai essayé minhaz de la suggestion, il ne semble pas aider. J'ai eu le même message d'erreur.

OriginalL'auteur The Starfox | 2013-03-25