2017-06-13 17 views
1

はAndroidスタジオに問題があります。何が間違っていることを確認またはファイルから欠落していない、ここに私のbuild.gradleファイルには、次のとおりです。AndroidManifest.xmlからpackageNameを読み取れません

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.1" 

    defaultConfig { 
     applicationId "aaa.myplugin" 
     minSdkVersion 15 
     targetSdkVersion 24 

    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile files('libs/classes.jar') 
} 

//task to delete the old jar 
task cleanJar(type: Delete) { 
    delete 'release/MyPlugin.jar' 
} 

//task to export contents as jar 
task exportJar(type: Copy) { 
    from('build/intermediates/bundles/release/') 
    into('release/') 
    include('classes.jar') 
    rename('classes.jar', 'MyPlugin.jar') 
} 

exportJar.dependsOn(cleanJar, build) 

そしてここでは、私のマニフェストファイルです。

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="aaa.myplugin"> 

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

    </application> 

</manifest> 

同じエラーを持ついくつかの質問がありますが、解決策のどれも私のために働いていませんでした。似たような問題があったら助けてください。

+0

build.gradleファイル(プロジェクトファイル)が間違っている可能性があります。モジュールbuild.gradleファイルに 'android'情報を追加する必要があります。詳細については、この回答を確認してください:https://stackoverflow.com/a/28296240/3442734 – Wrobel

+0

うわー、あなたは正しいです。どのように私はそれらを混乱させることができたか分からない。ありがとうございました –

+1

Wrobelがコメントしたように、ここに問題の解決策があります。 https://stackoverflow.com/questions/28295933/difference-between-build-gradleproject-and-build-gradlemodule/28296240#28296240 –

答えて

0

Androidスタジオを開くことができます。スクリーンショットと同じように、プロジェクトモデルが開いていることを確認してください。次に、エラーを参照しているパッケージを削除してみてください。

0

間違ったプラグインを使用しているプラ​​グインは上記

apply plugin: 'com.android.library' 

は、ライブラリプロジェクトのためにある

APPLICATIONIDはアプリのために、それが

はとてもアプリケーションIDを追加したライブラリを使用することはできませんされ

次のプラグインを持つbuild.gradleファイル

apply plugin: 'com.android.application' 
関連する問題