本文介绍了Android的 - 谷歌地图API第2版 - 的NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试运行谷歌地图与IntelliJ IDEA的12。
I try to run Google Maps with Intellij IDEA 12.
我已经尝试过建议:
- Embedding谷歌地图的Android V2在机器人
- <一个href="http://stackoverflow.com/questions/13696620/google-maps-android-api-v2-authorization-failure?rq=1">Google地图Android的API V2授权失败
- Unable实例android.gms.maps.MapFragment
- Google地图Android的API提供了一个NoClassDefFoundError的
- Embedding google maps android v2 in android
- Google Maps Android API v2 Authorization failure
- Unable instantiate android.gms.maps.MapFragment
- Google Maps Android API gives a NoClassDefFoundError
等。但不幸的是,这并不为我工作。
and so on. But unfortunately that doesn't work for me.
我的配置:
1)真实设备HTC wildefire S,安卓2.3.5
1) real device htc wildefire s, android 2.3.5
2)
2)
3)的AndroidManifest.xml
:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.ergeslab.TransportScheduleYaroslavl"
android:installLocation="auto"
android:versionCode="1"
android:versionName="1.0">
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<permission
android:name="ru.ergeslab.TransportScheduleYaroslavl.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="ru.ergeslab.TransportScheduleYaroslavl.permission.MAPS_RECEIVE"/>
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<application android:label="@string/app_name">
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MY_KEY"/>
<uses-library android:name="com.google.android.maps" />
<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>
</application>
</manifest>
4) MainActivity:
<pre>
package ru.ergeslab.TransportScheduleYaroslavl;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
5)的main.xml
:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
6)IDE项目设置:
6) IDE project settings:
完整的Android logcat的:
Full Android logcat:
04-02 21:27:07.718: ERROR/AndroidRuntime(24277): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:250)
at android.app.Activity.setContentView(Activity.java:1712)
at ru.ergeslab.TransportScheduleYaroslavl.MainActivity.onCreate(MainActivity.java:13)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1794)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
at android.app.ActivityThread.access$1500(ActivityThread.java:132)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4277)
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:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
任何帮助是极大的AP preciated。
Any help is greatly appreciated.
推荐答案
我终于跑到我的应用程序!
I finally ran my application!
我没有修改清单,布局和活动,刚刚更新的项目设置:
I didn't edit manifest, layout and activity, just updated project settings:
我希望这将帮助别人。
这篇关于Android的 - 谷歌地图API第2版 - 的NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!