编辑:对于那些苦苦挣扎的人,请查看this link.仔细关注它,但确实有效!关键部分是使用keytool为您的调试密钥库生成SHA1哈希.另外,不要忘记添加一个用于发布!
我一直在尝试设置谷歌地图AndroID API v2并在设置了所有内容后说我得到了这个运行时异常ClassNotFound:
01-02 16:29:07.927: E/AndroIDRuntime(12508): FATAL EXCEPTION: main01-02 16:29:07.927: E/AndroIDRuntime(12508): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MapActivity}: androID.vIEw.InflateException: Binary XML file line #6: Error inflating class fragment01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:1659)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.app.ActivityThread.access00(ActivityThread.java:121)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:943)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.os.Handler.dispatchMessage(Handler.java:99)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.os.Looper.loop(Looper.java:130)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.app.ActivityThread.main(ActivityThread.java:3701)01-02 16:29:07.927: E/AndroIDRuntime(12508): at java.lang.reflect.Method.invokeNative(Native Method)01-02 16:29:07.927: E/AndroIDRuntime(12508): at java.lang.reflect.Method.invoke(Method.java:507)01-02 16:29:07.927: E/AndroIDRuntime(12508): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)01-02 16:29:07.927: E/AndroIDRuntime(12508): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:624)01-02 16:29:07.927: E/AndroIDRuntime(12508): at dalvik.system.NativeStart.main(Native Method)01-02 16:29:07.927: E/AndroIDRuntime(12508): Caused by: androID.vIEw.InflateException: Binary XML file line #6: Error inflating class fragment01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:581)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.vIEw.LayoutInflater.rInflate(LayoutInflater.java:623)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:408)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:320)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:276)01-02 16:29:07.927: E/AndroIDRuntime(12508): at com.androID.internal.policy.impl.PhoneWindow.setContentVIEw(PhoneWindow.java:227)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.app.Activity.setContentVIEw(Activity.java:1657)01-02 16:29:07.927: E/AndroIDRuntime(12508): at com.example.app.MapActivity.onCreate(MapActivity.java:11)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:1623)01-02 16:29:07.927: E/AndroIDRuntime(12508): ... 11 more01-02 16:29:07.927: E/AndroIDRuntime(12508): Caused by: java.lang.classNotFoundException: androID.vIEw.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.app-1.apk]01-02 16:29:07.927: E/AndroIDRuntime(12508): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)01-02 16:29:07.927: E/AndroIDRuntime(12508): at java.lang.classLoader.loadClass(ClassLoader.java:551)01-02 16:29:07.927: E/AndroIDRuntime(12508): at java.lang.classLoader.loadClass(ClassLoader.java:511)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.vIEw.LayoutInflater.createVIEw(LayoutInflater.java:471)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.vIEw.LayoutInflater.onCreateVIEw(LayoutInflater.java:549)01-02 16:29:07.927: E/AndroIDRuntime(12508): at com.androID.internal.policy.impl.PhoneLayoutInflater.onCreateVIEw(PhoneLayoutInflater.java:66)01-02 16:29:07.927: E/AndroIDRuntime(12508): at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:568)01-02 16:29:07.927: E/AndroIDRuntime(12508): ... 20 more
有没有人曾经遇到过这个?
XML:
<?xml version="1.0" enCoding="utf-8"?><fragment xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:ID="@+ID/map" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" />
MapActivity:
import androID.os.Bundle;import androID.app.Activity;public class MapActivity extends Activity { @OverrIDe protected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_map); }}
解决方法:
您的活动需要从支持库扩展FragmentActivity
总结以上是内存溢出为你收集整理的java – Google Maps Android API v2 ClassNotFound运行时错误全部内容,希望文章能够帮你解决java – Google Maps Android API v2 ClassNotFound运行时错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)