1

have a problem with android studio. Not sure what is wrong or missing from the files, here is my build.gradle file:

// 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)

And here is my manifest file:

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

There are several questions with the same error, but none of the solutions did work for me. Please help if you had a similar problem.

kek pnchi
  • 11
  • 1
  • 2
  • It's possible that it is wrong build.gradle file (project file), You should add 'android' info in module build.gradle file. Check this answer for more info: https://stackoverflow.com/a/28296240/3442734 – Wrobel Jun 13 '17 at 08:02
  • Wow, you are right. not sure how I managed to confuse them. Thanks a lot – kek pnchi Jun 13 '17 at 09:21
  • 1
    As Wrobel commented, here is a solution to the problem. https://stackoverflow.com/questions/28295933/difference-between-build-gradleproject-and-build-gradlemodule/28296240#28296240 – kek pnchi Jun 13 '17 at 09:22

2 Answers2

1

you have used wrong plugin

apply plugin: 'com.android.library'

above plugin is for library projects

applicationId is for app, it cannot be used with libraries

so add application id to the build.gradle file which has following plugin

apply plugin: 'com.android.application'
Maninder Taggar
  • 306
  • 3
  • 8
-1

You can open Android studio,make sure that you project is open with the project model,just like the screen-capture .Now ,you can try to delete the package that has been referred to the error.

H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
TWei
  • 1