Gradle 'MyApp' project refresh failed. A strange kind of error - android

I have recently update Android Studio to Android Studio 2.1.2. I have stuck with a strange error. Error is printed below. This happens when I just create new android studio project.
Gradle 'myapp' project refresh failed
Error:No toolchains found in the NDK toolchains folder for ABI with prefix: aarch64-linux-android
Note : I am using java8 and the module gradle.build file looks like below. Since I have just created the project I have not added any NDK related files.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.myapp"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}

Related

Android gradle sync error-Could not create an instance of Tooling API implementation

I recently installed android studio 2.1.2 and I am getting this error:
Error:Could not create an instance of Tooling API implementation using the specified Gradle distribution 'https://services.gradle.org/distributions/gradle-2.10-all.zip'.
I used to have 1.3.1 previously but I opened it recently after a while and it was showing the same error so I decided to do a fresh installation but the error persists.
Here is what the build.gradle file looks like for the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.example.sanchitverma.myapplication"
minSdkVersion 23
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}

Unable to open android project in windows

I'm new to android and developing android application of password manager. I started working in Ubuntu android studio and due to some problem I switched to windows 10 but Unable to import project showing error of app:compileDebugAidl or Aidl is missing. I tried to change version from 23.2.0 to 21.0.2 or 21.0.0 but unable to solve. please suggest
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.devil.password"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
}

Warning:Module version com.android.support:appcompat-v7:23.1.0 depends on libraries but is a jar

When I created a new project in Android Studio bundle it is displaying the following error:
Warning:Module version com.android.support:appcompat-v7:23.1.0 depends on libraries but is a jar
Error:A problem occurred configuring project ':app'.
Could not find appcompat-v7.jar (com.android.support:appcompat-v7:23.1.0).
Searched in the following locations:
file:/C:/Users/PRASOON SHARMA/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.1.0/appcompat-v7-23.1.0.jar
I am not sure where I have made the mistake.
Here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.prasoonsharma.club"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:+'
}
It happen because of you use plus + on:
compile 'com.android.support:appcompat-v7:+'
Gradle is confused to decide the location that will be used to compiling the library, i.e. in file:/C:/Users/PRASOON SHARMA/AppData/Local/Android/sdk/extras/android/m2repository/ or in file:/C:/Users/PRASOON SHARMA/AppData/Local/Android/sdk/extras/android/support/v7/appcompat. So, the gradle script should look like this:
compile 'com.android.support:appcompat-v7:23.1.0'
Update Support Library to the latest version, and rebuild your project.

Failed to resolve:com.loopj.android:android-async-http:1.4.8

I have downloaded jar file of Loopj library and placed it in libs folder. have tried many changes but getting same error. Can anyone please help me to solve this.
build.gradle :-
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.pratik.receivedsms"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.loopj.android:android-async-http:1.4.8'
}
What worked for me is opening gradle terminal from android studio and executing the following command:
gradlew installarchives
It should also work without downloading the jar file.
Another note is that I am using version 1.4.5.
Good luck!

Include apk module as dependency in android studio

I have two modules in my project:
app
app_list
Both modules have java and res. app_list has some activities that I want to launch in app.
In Eclipse, I had app_list as dependency library and I was able to launch activity of app_list. In Android Studio, when I added app_list as dependency, it says:
"Error:A problem occurred configuring project ':app'.
> Dependency NewMathBuzz:app_list:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: <home>/NewMathBuzz/app_list/build/outputs/apk/app_list-release-unsigned.apk
"
app > build.gradle is as below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.mass.mathbuzz"
minSdkVersion 7
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(':app_list')
compile fileTree(dir: 'libs', include: ['*.jar'])
}
app_list > build.gradle is as below:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.android.support:appcompat-v7:22.0.0'
}
Could someone help me with this?
Everything was fine,
basically when I changed app_list.gradle as
apply plugin: 'com.android.application' to apply plugin: 'com.android.library' and deleted applicationId from app_list.gradle
it compiled and generated apk but I was getting runtime error that was because both app and app_list both had same resource main_activity so R.java didn't have main_activity res of app_list so it was giving illegal_parameter error . When I changed name of main_activity to some unique name it solved the issue

Categories

Resources