简体   繁体   English

ActivityNotFoundException:但已在清单中声明了活动

[英]ActivityNotFoundException: but activity has been declared in manifest

hoping for some help. 希望能有所帮助。 I am receiving an error: 我收到一个错误:

04-13 15:01:45.336: E/AndroidRuntime(11065): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.domakecreatedesign.getfit/com.domakecreatedesign.runtracker.RunActivity}; 04-13 15:01:45.336:E / AndroidRuntime(11065):android.content.ActivityNotFoundException:无法找到明确的活动类{com.domakecreatedesign.getfit / com.domakecreatedesign.runtracker.RunActivity}; have you declared this activity in your AndroidManifest.xml? 您是否在AndroidManifest.xml中声明了此活动? ... ...

However I have declared said class RunActivity in the manifest. 但是我已经在清单中声明了类RunActivity。 However, I notice that the path is not correct, it should be calling com.domakecreatedesign.runtracker.RunActivity, however as you can see from above, it is making a call for: com.domakecreatedesign.getfit/com.domakecreatedesign.runtracker.RunActivity... 但是,我注意到该路径不正确,应该调用com.domakecreatedesign.runtracker.RunActivity,但是从上面可以看到,它正在调用com.domakecreatedesign.getfit / com.domakecreatedesign.runtracker。 RunActivity ...

I have no idea why this is. 我不知道为什么会这样。 Here is my my manifest xml 这是我的清单XML

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

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <permission
        android:name="com.domakecreatedesign.getfit.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.domakecreatedesign.getfit.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <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" />
    <uses-permission
        android:name="android.permission.GET_ACCOUNTS"
        android:maxSdkVersion="19" />
    <uses-permission
        android:name="android.permission.USE_CREDENTIALS"
        android:maxSdkVersion="19" />

    <uses-feature
        android:name="android.hardware.location.gps"
        android:required="true" />
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/getfit_icon"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat.Light" >

        <meta-data android:name="com.google.android.gms.version" 
            android:value="@integer/google_play_services_version" />


        <!-- Splash screen -->

        <activity
            android:name="com.domakecreatedesign.getfit.SplashScreen"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Black.NoTitleBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- Main Activity -->
        <activity
            android:name="com.domakecreatedesign.getfit.MainActivity"
            android:label="@string/app_name" />

        <activity
            android:name="com.domakecreatedesign.getfit.ChooseLogin"
            android:label="@string/title_activity_fblogin" />


        <activity
            android:name="com.domakecreatedesign.getfit.gplus_Login"
            android:label="@string/app_name" />

        <activity
            android:name="com.domakecreatedesign.getfit.Main_Menu"
            android:label="@string/app_name" />


        <activity
            android:name="com.domakecreatedesign.runtracker.RunListActivity"
            android:label="@string/app_name" />


        <activity
            android:name="com.domakecreatedesign.runtracker.RunMapActivity"
            android:label="@string/app_name" />

        <activity
            android:name="com.domakecreatedesign.runtracker.RunActivity"
            android:label="@string/app_name" />




        <receiver
            android:name=".TrackingLocationReceiver"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.domakecreatedesign.runtracker.ACTION_LOCATION" />
            </intent-filter>
        </receiver>

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyATK_V5Ae2g7uJQM1EBhEcPZAL19B8jBuc" />
    </application>

</manifest>

And the calling method is: 调用方法是:

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    // the id argument will be the Run ID; CursorAdapter gives us this for free
    Intent i = new Intent(getActivity(), com.domakecreatedesign.runtracker.RunActivity.class);
    i.putExtra(com.domakecreatedesign.runtracker.RunActivity.EXTRA_RUN_ID, id);
    startActivity(i);
}

Also worth noting, the application is contained within two packages 同样值得注意的是,该应用程序包含在两个软件包中

  1. com.domakecreatedesign.getfit com.domakecreatedesign.getfit
  2. com.domakecreatedesign.runtracker com.domakecreatedesign.runtracker

Does this need to be declared somehow in the manifest? 是否需要在清单中以某种方式声明它?

Any help would be very much appreciated. 任何帮助将不胜感激。

Many thanks 非常感谢

try ActivityName.this instead of getActivity() 尝试使用ActivityName.this而不是getActivity()

Intent i = new Intent(getActivity(), com.domakecreatedesign.runtracker.RunActivity.class);

something like this, 像这样

Intent i = new Intent(AcitivityName.this, com.domakecreatedesign.runtracker.RunActivity.class);

Try this.. 尝试这个..

Intent i = new Intent();
i.setComponent(new ComponentName("com.domakecreatedesign.getfit", "com.domakecreatedesign.runtracker.RunActivity"));
startActivity(i);

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

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