我正在尝试使用Google API构建应用,并且我按照互联网上的每个步骤来了解如何使用Google API,但是当我运行我的应用时,它会启动然后立即关闭。
logcat的
04-21 19:07:19.857 16778-16778/? I/art: Late-enabling -Xcheck:jni
04-21 19:07:19.858 16778-16778/? I/art: Reinit property: dalvik.vm.checkjni= false
04-21 19:07:20.052 16778-16778/com.example.kakarot.cpecroute W/System: ClassLoader referenced unknown path: /data/app/com.example.kakarot.cpecroute-1/lib/arm64
04-21 19:07:20.065 16778-16778/? I/InstantRun: starting instant run server: is main process
04-21 19:07:20.074 16778-16778/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.kakarot.cpecroute, PID: 16778
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.kakarot.cpecroute/com.example.kakarot.cpecroute.MapsActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.kakarot.cpecroute.MapsActivity" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.kakarot.cpecroute-1/base.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.kakarot.cpecroute-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2698)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2870)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1573)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6605)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:999)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:889)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.kakarot.cpecroute.MapsActivity" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.kakarot.cpecroute-1/base.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.kakarot.cpecroute-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1083)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2688)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2870)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1573)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6605)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:999)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:889)
04-21 19:07:20.083 16778-16778/? I/Process: Sending signal. PID: 16778 SIG: 9
............................................... ..............................
的AndroidManifest.xml /活性
@Sagar是的,AndroidManifest.xml中有一个活动。 下面是代码
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
答案 0 :(得分:0)
试试这个:
<activity android:name="com.yourpackagename.MapsActivity" android:label="@string/title_activity_maps"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
让我知道这是否有效