简体   繁体   English

找不到我的MainActivity

[英]Can't find my MainActivity

I get this error when I attempt to run my mapping app, which is frankly little more than the Google Maps demo program, set to open a map in the Strybing Arboretum. 尝试运行地图应用程序时,会收到此错误消息,坦率地说,该应用程序比Google Maps演示程序要多一点,该程序设置为在Strybing Arboretum中打开地图。

11-18 19:01:36.890: E/AndroidRuntime(18243): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{net.stuffilike.strybing/net.stuffilike.strybing.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "net.stuffilike.strybing.MainActivity" on path: DexPathList[[zip file "/data/app/net.stuffilike.strybing-1.apk"],nativeLibraryDirectories=[/data/app-lib/net.stuffilike.strybing-1, /vendor/lib, /system/lib]] 11-18 19:01:36.890:E / AndroidRuntime(18243):java.lang.RuntimeException:无法实例化活动ComponentInfo {net.stuffilike.strybing / net.stuffilike.strybing.MainActivity}:java.lang.ClassNotFoundException:Didn在路径上找不到类“ net.stuffilike.strybing.MainActivity”:DexPathList [[zip文件“ /data/app/net.stuffilike.strybing-1.apk"],nativeLibraryDirectories=[/data/app-lib/net .stuffilike.strybing-1,/ vendor / lib,/ system / lib]]

Is it possible that I have somehow put it in an inaccessible location? 我是否有可能以某种方式将其放在人迹罕至的地方? I note this 我注意到这个

net.stuffilike.strybing/net.stuffilike.strybing.MainActivity net.stuffilike.strybing / net.stuffilike.strybing.MainActivity

path nomenclature, and wonder about it. 路径命名法,对此感到疑惑。 As far as I can tell there is nothing at all special about this little program except the inclusion of the google-play-services_lib, which I haven't ever used before. 据我所知,除了包含google-play-services_lib(我以前从未使用过)之外,这个小程序没有什么特别之处。

Has anyone had and solved this problem? 有没有人解决过这个问题?

Manifest: 表现:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.stuffilike.strybing" android:versionCode="1"
android:versionName="1.0">

<uses-feature android:glEsVersion="0x00020000"
    android:required="true" />
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="21" />

    <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" />

<!-- The following two permissions are not required to use Google Maps Android 
    API v2, but are recommended. -->

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
    android:allowBackup="true" android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.gms.maps" /> 
    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version"/>

<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>

<!-- [mapscodenumber]-->
    <meta-data android:name="com.google.android.maps.v2.API_KEY"
        android:value="[mapscodenumber]" />
</application>

</manifest>

Package line from MainActivity: 来自MainActivity的包装行:

package net.stuffilike.strybing;

You need to update your manifest and for your MainActivity set: 您需要更新清单和MainActivity集:

android:name="net.stuffilike.strybing.MainActivity"

Of course net.stuffilike.strybing must match the package in which MainActivity resides in. 当然net.stuffilike.strybing必须与MainActivity所在的包匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM