My debug AndroidManifest.xml is giving me “cannot

2019-03-11 14:32发布

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="ac.tec.oop.ahorcado.android"
          android:versionCode="1" 
          android:versionName="1.0">

    <uses-sdk android:minSdkVersion="7" 
              android:targetSdkVersion="16"/>

    <application android:allowBackup="true" 
                    android:icon="@drawable/ic_launcher" 
                    android:label="@string/app_name" 
                    android:theme="@style/AppTheme">
        <activity android:label="@string/app_name"
                  android:name="ac.tec.oop.ahorcado.android.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

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

</manifest>

These lines are giving me "cannot resolve symbol errors", even though the packages from which they need to be referenced is clearly written. I've trying to fix this for hours but I don't know what else to do. I'm using Android Studio, and it has caused me a great number of problems.

android:icon="@drawable/ic_launcher 
android:label="@string/app_name" 
android:theme="@style/AppTheme">
android:name="ac.tec.oop.ahorcado.android.MainActivity">

4条回答
聊天终结者
2楼-- · 2019-03-11 14:42

Go to File > Invalidate Caches / Restart and Invalidate and Restart.

This cleared the errors for me.

查看更多
别忘想泡老子
3楼-- · 2019-03-11 14:43

I tried all mentioned Answer but non of above worked for me
The only Solution worked for me was
Go to Gradle(App)> in the repositories {}> make sure that mavenCentral() is on top>and now remove compile 'which you recently added>sync > Now add again compile "again add the dependencies" > and final sync again
This worked for me

查看更多
我想做一个坏孩纸
4楼-- · 2019-03-11 14:48

try to add debuggable to true in application tag in manifest

<application android:allowBackup="true" 
                android:debuggable="true"
                android:icon="@drawable/ic_launcher" 
                android:label="@string/app_name" 
                android:theme="@style/AppTheme">

I hope it,s work for you.

查看更多
兄弟一词,经得起流年.
5楼-- · 2019-03-11 15:04

There is no issue with your Manifest code this will work fine

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="ac.tec.oop.ahorcado.android"
          android:versionCode="1" 
          android:versionName="1.0">

    <uses-sdk android:minSdkVersion="7" 
              android:targetSdkVersion="16"/>

    <application android:allowBackup="true" 
                    android:icon="@drawable/ic_launcher" 
                    android:label="@string/app_name" 
                    android:theme="@style/AppTheme">
        <activity android:label="@string/app_name"
                  android:name="ac.tec.oop.ahorcado.android.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

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

</manifest>

Some times Eclipse shows unexpected behavior you can cut and paste again the code to Manifest or just restart the IDE it will recompile and remove the error

查看更多
登录 后发表回答