3

我試圖建立我的AndroidStudio版本0.4.4 Android項目,但出現了一些問題後,我感動了文件的build.gradle,現在看起來是這樣的:的Android工作室搖籃無效文件的Manifest.xml

apply plugin: 'android' 
      android { 
       compileSdkVersion 19 
       buildToolsVersion "19.0.1" 

       defaultConfig { 
        minSdkVersion 9 
        targetSdkVersion 19 
        versionCode 1 
        versionName "1.0" 
       } 

       signingConfigs { 
        release { 
         storeFile file('somekey.jks') 
         storePassword "pass" 
         keyAlias "alias" 
         keyPassword "pass" 
        } 
       } 

       buildTypes { 
        release { 
         signingConfig signingConfigs.release 
         runProguard false 
         debuggable false 
         jniDebugBuild false 
         zipAlign true 
         renderscriptDebugBuild false 
         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
        } 

        debug { 
         debuggable true 
         jniDebugBuild true 
         renderscriptDebugBuild true 
        } 
       } 
      } 

      dependencies { 
       compile 'com.android.support:gridlayout-v7:19.0.1' 
       compile 'com.android.support:support-v4:19.0.1' 
       compile 'com.android.support:appcompat-v7:+' 
       compile 'com.google.android.gms:play-services:4.2.42' 
      } 

這就像在此之前:

apply plugin: 'android' 
android { 
compileSdkVersion 19 
buildToolsVersion "19.0.1" 

defaultConfig { 
    minSdkVersion 8 
    targetSdkVersion 19 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     runProguard false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
    } 
} 
} 

dependencies { 
    compile 'com.android.support:gridlayout-v7:19.0.1' 
    compile 'com.android.support:support-v4:19.0.1' 
    compile 'com.android.support:appcompat-v7:+' 
    compile 'com.google.android.gms:play-services:4.2.42' 
} 

現在每次我嘗試運行我的項目時收到此錯誤:

Throwable: Invalid file: file://C:/Users/user/AndroidStudioProjects/myprojectname/myproject/build/manifests/debug/AndroidManifest.xml 

有誰知道如何解決這個問題?

+0

從'Build> Clean Project'清理一次你的項目,並確保在出現reBuild後出錯的路徑中存在AndroidManifest。 – pyus13

+0

我在發佈之前試過,並沒有奏效。但是今天當打開AndroidStudio時,問題就沒有了...... – Daivid

回答

16

這是一個巧合,只要我評論你的問題,我也結束了同樣的錯誤,我解決了它自己的錯誤。

File > Invalidate Caches/Restart 

解決了我的問題。

+0

下次發生這種情況時,我會試試。今天,當我打開AndroidStudio時,問題消失了。 – Daivid

+0

確定接受答案,如果它也解決了你的問題,所以對其他人很有用。 – pyus13

+0

我必須建立 - >清理項目,然後文件 - >無效緩存/重新啓動 – RandomEngy

0

我有同樣的問題。我發現它是由於當我有一個已經運行的應用程序後,

Build - > Clean Project或Build - > Rebuild Project然後嘗試運行該項目。

的解決方案是通過以終止正在運行的應用:

1)前往Android DDMS窗口,6:機器人。

2)選擇正在運行的應用程序。

3)單擊X(終止應用程序)。

相關問題