gpt4 book ai didi

android - java.lang.IllegalAccessError : Class ref in pre-verified class resolved to unexpected implementation 错误

转载 作者:行者123 更新时间:2023-11-30 03:04:35 25 4
gpt4 key购买 nike

包 com.fio.gmapsactivity;

GMapsActivity

    import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
public class GMapsActivity extends MapActivity {
private MapView mapView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
mapView = (MapView) findViewById(R.id.map_view);
mapView.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}

activity_map.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="AIzaSyB4sGJQVW1hJpOtWnTHvDw5IxV_YOPA9eA"
android:clickable="true"
android:enabled="true" />
</RelativeLayout>

Mainfest.xml

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fio.gmapsactivity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.fio.gmapsactivity.GMapsActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyB4sGJQVW1hJpOtWnTHvDw5IxV_YOPA9eA" />
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

我已经添加了 jar 文件(效果、 map 、USB)。但无法映射。只显示错误。无法找到错误。请帮助我。

错误

    02-25 02:49:31.993: E/AndroidRuntime(1812): FATAL EXCEPTION: main
02-25 02:49:31.993: E/AndroidRuntime(1812): java.lang.IllegalAccessError: Class ref in pre- verified class resolved to unexpected implementation
02-25 02:49:31.993: E/AndroidRuntime(1812): at dalvik.system.DexFile.defineClass(Native Method)
02-25 02:49:31.993: E/AndroidRuntime(1812): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:211)
02-25 02:49:31.993: E/AndroidRuntime(1812): at dalvik.system.DexPathList.findClass(DexPathList.java:313)
02-25 02:49:31.993: E/AndroidRuntime(1812): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:51)
02-25 02:49:31.993: E/AndroidRuntime(1812): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-25 02:49:31.993: E/AndroidRuntime(1812): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-25 02:49:31.993: E/AndroidRuntime(1812): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
02-25 02:49:31.993: E/AndroidRuntime(1812): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
02-25 02:49:31.993: E/AndroidRuntime(1812): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
02-25 02:49:31.993: E/AndroidRuntime(1812): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-25 02:49:31.993: E/AndroidRuntime(1812): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
02-25 02:49:31.993: E/AndroidRuntime(1812): at android.os.Handler.dispatchMessage(Handler.java:99)
02-25 02:49:31.993: E/AndroidRuntime(1812): at android.os.Looper.loop(Looper.java:137)
02-25 02:49:31.993: E/AndroidRuntime(1812): at android.app.ActivityThread.main(ActivityThread.java:5103)
02-25 02:49:31.993: E/AndroidRuntime(1812): at java.lang.reflect.Method.invokeNative(Native Method)
02-25 02:49:31.993: E/AndroidRuntime(1812): at java.lang.reflect.Method.invoke(Method.java:525)
02-25 02:49:31.993: E/AndroidRuntime(1812): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
02-25 02:49:31.993: E/AndroidRuntime(1812): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-25 02:49:31.993: E/AndroidRuntime(1812): at dalvik.system.NativeStart.main(Native Method)

最佳答案

我自己刚遇到这个。当您的类被编译到 classes.dex 文件中时,依赖类具有特定的规范。当 classes.dex 文件在应用程序或测试执行期间加载时,依赖类看起来不同。通常,这是在您的项目中双重包含一个库的结果(它们是不同的)。由于您提到您添加了 jar 文件,您可能会删除所有这些文件并在出现错误时重新添加它们。我建议在运行之间完全清理您的项目,因为如果您不在构建之间更改源文件,构建系统可能不会重新编译您的 classes.dex 文件。出于同样的原因,有时您可能能够成功构建,而有时您构建并获得导致此错误的 apk。

此外,我可以看到您正在使用 Google Play 服务。您需要确保仅通过库项目(仅限 Eclipse)或依赖项指令 (Gradle) 包含该依赖项。如果您为 Google Play 服务手动包含一个 jar,也会导致此问题。

关于android - java.lang.IllegalAccessError : Class ref in pre-verified class resolved to unexpected implementation 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22008218/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com