我在Android Studio中有一个显示地图的项目。
一切正常(包括地图),直到我尝试拨打mMap_.setMyLocationEnabled(true);
。它会产生以下错误:
09-29 00:55:41.873 1450-1450/com.packages.appname W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40218560)
09-29 00:55:41.914 1450-1450/com.packages.appname E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.packages.appname/activity.SelectLocationInMapActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f100000
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1768)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
at android.app.ActivityThread.access$1500(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f100000
at android.content.res.Resources.getValue(Resources.java:929)
at android.content.res.Resources.getInteger(Resources.java:736)
at maps.ag.bp.a(Unknown Source)
at maps.ag.an.c(Unknown Source)
at bns.onTransact(SourceFile:274)
at android.os.Binder.transact(Binder.java:279)
at com.google.android.gms.maps.internal.IGoogleMapDelegate$a$a.setMyLocationEnabled(Unknown Source)
at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(Unknown Source)
at activity.SelectLocationInMapActivity.onCreate(SelectLocationInMapActivity.java:85)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
... 11 more
未找到资源......很奇怪。完全相同的代码WORKS IN ANDROID 4现在。如果我删除冲突的呼叫,它也可以在2.x中顺利运行。所以,它不是API密钥的问题,如何包含库,SDK或编辑器不是最新的......
将我的“旧”Android工作室项目迁移到Gradle系统后出现问题。在切换之前,我使用位于<android sdk>\extras\google\google_play_services\libproject\google-play-services_lib\libs
的.jar文件,但现在它从build.gradle文件中的规范自动下载/导入:
dependencies {
...
compile 'com.google.android.gms:play-services:3.2.25'
...
}
是否有人遇到同样的问题?你有什么建议吗?我没有想法......