简体   繁体   中英

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.

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

Is it possible that I have somehow put it in an inaccessible location? I note this

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.

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:

package net.stuffilike.strybing;

You need to update your manifest and for your MainActivity set:

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

Of course net.stuffilike.strybing must match the package in which MainActivity resides in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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