轉換我的一個應用程序來使用新的谷歌地圖業務包,現在我堅持崩潰每當我們的活動嘗試調用我們的onCreate中的setContentView() () 方法。
的build.gradle:
dependencies {
// external dependencies: will need network connection if not already cached
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:support-v4:21.0.3'
// local dependencies: jar libraries checked into source control
compile files('libs/resty-0.3.4.jar')
compile files('libs/robospice-1.4.9.jar')
compile files('libs/robospice-cache-1.4.9.jar')
compile files ('libs/maps_m4b-2.12.0.rc1.jar')
}
activity_location.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.m4b.maps.MapFragment" />
崩潰:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/m4b/maps/R$styleable;
at com.google.android.m4b.maps.GoogleMapOptions.createFromAttributes(GoogleMapOptions.java:428)
at com.google.android.m4b.maps.MapFragment.onInflate(MapFragment.java:408)
at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2115)
at android.app.Activity.onCreateView(Activity.java:5282)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:916)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:802)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2144)
at com.nate.android.hammerhead.LocationActivity.onCreate(LocationActivity.java:106)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.m4b.maps.R$styleable" on path: DexPathList[[zip file "/data/app/com.nate.android.hammerhead-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.google.android.m4b.maps.GoogleMapOptions.createFromAttributes(GoogleMapOptions.java:428)
at com.google.android.m4b.maps.MapFragment.onInflate(MapFragment.java:408)
at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2115)
at android.app.Activity.onCreateView(Activity.java:5282)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:916)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:802)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2144)
at com.nate.android.hammerhead.LocationActivity.onCreate(LocationActivity.java:106)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Suppressed: java.lang.ClassNotFoundException: com.google.android.m4b.maps.R$styleable
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 28 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
我跟隨由谷歌(https://developers.google.com/maps/documentation/business/mobile/android/)提供的指南,什麼應該有一直是新的靜態jar庫的簡單交換已經變成了配置夜晚母馬試圖追蹤這個很少或無濟於事。
從文檔中,您應該刪除對com.google.android.gms.maps包的任何引用。如果您在自己的應用中使用Play服務來使用其他Google API,請確保您僅使用Google Maps Mobile SDK for Work(com.google.android.m4b.maps包)訪問Maps.' – ztan 2015-03-02 22:28:22
我已經已經刪除了對com.google.android.gms.maps包的所有引用。我仍然包含播放服務的原因是因爲我需要Google Analytics的依賴關係。 – 2015-03-02 23:47:31