Ali
Ali

Reputation: 17

Android Studio Error While Building APK

I am be making the final version of an app with the following Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "ir.garsah.information"
        minSdkVersion 14
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {

            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }
    buildToolsVersion '27.0.3'
}

dependencies {

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'


}

However, I get this error:

Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.1.1).

I searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/26.1.1/intellij-core-26.1.1.jar

img

Upvotes: 2

Views: 3419

Answers (3)

donturner
donturner

Reputation: 19146

You'll get this error if your gradle plugin is no longer available.

Update your gradle plugin to the latest version. Open build.gradle for the project (not the app) and find the following line:

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
}

Check the latest available plugin version here and update it. For me it was:

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
}

You may also need to update your gradle version in gradle/wrapper/gradle-wrapper.properties. Update the following line:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

Upvotes: 1

Mahdi Rafatjah
Mahdi Rafatjah

Reputation: 1072

I have had this problem for like a month or so, messing around settings and found this. just check this ("Enable embedded Maven repository") and enjoy. enter image description here

Upvotes: 5

Dnyaneshwar Panchal
Dnyaneshwar Panchal

Reputation: 444

You can put the tools where ever you would like, including in your home directory, you just need to make sure that $ANDROID_HOME points to where that is and that the PATH uses the $ANDROID_HOME variable (remember, order is important here). You can evaluate your current "PATH" by running echo $PATH.

Assuming the permissions are corrected and that your PATH is as you specified, you should have no problem running android since the android command should be in the /opt/Android/Sdk/tools directory. If you continue to have problems, I may recommend installing the larger Android Studio which might take care of some things for you, including permissions and SDK location.

Also put this lines on your app build.gradle file,

lintOptions {
    disable "ResourceType"
} 

Upvotes: 0

Related Questions