android studio problem - Android Studio

Hi, i have the next problem, when i open a project in android stuidio, appear the next message
Error:Could not create an instance of Tooling API implementation using the specified Gradle installation 'C:\Program Files\Android\Android Studio\gradle\gradle-2.8'.
what could be? and What i can do?
Thanks for all

Have you tried updating Android Studio?
Also you could show build.gradle file for this project.

klisiecki said:
Have you tried updating Android Studio?
Also you could show build.gradle file for this project.
Click to expand...
Click to collapse
this show the file build.gradle
// 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:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Hi!
Try to use last version of android studio gradle plugin.
Just change line
Code:
classpath 'com.android.tools.build:gradle:1.5.0'
to
Code:
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'

Related

Error:(8, 0) Gradle DSL method not found: compile()

I'm trying to reduce google play services' impact on APK size. I get the following error when i try to synchronize the gradle proyect. I would be very thankful if somebody can help me with this problem.
Error8, 0) Gradle DSL method not found: 'compile()'
Possible causes:
- The project 'MorphingTunnelFreeLauncher' may be using a version of Gradle that does not contain the method. Gradle settings
- The build file may be missing a Gradle plugin.
The changes in the gradle code looks like this:
- build.gradle in googleplayservices_lib
apply plugin: 'com.android.library'
android {
compileSdkVersion 9
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 9
targetSdkVersion 9
}
buildTypes {
release {
minifyEnabled true //changed
shrinkResources true //changed
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile files('libs/google-play-services.jar')
}
- build.gradle in the app itself:
// 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:1.1.0'
compile 'com.google.android.gmslay-services-ads:6.5.+'//changed
}
}
allprojects {
repositories {
jcenter()
}
}

[Q] Android Studio error when importing libs

I am trying to import some libraries, in Android Studio. I had the following error message: Error:The SDK Build Tools revision (17.0.0) is too low for project ':actionbarsherlock'. Minimum required is 19.1.0
So i installed Android SDK Build tools rev 19.1.0. I modified build.gradle file (app) looking like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.example.xx.xx"
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "1.2"
}
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:19.1.0'
compile 'com.android.support:support-v4:19.1.0'
compile project(':actionbarsherlock')
compile project(':actionbarsherlock-fest')
compile project(':actionbarsherlock-i18n')
}
Also in Run/Debug Configurations, under App Engine DevAppServer, i set in App Engine SDK field the path for the new SDK, looks like that: C:\Users\cami\AppData\Local\Android\sdk\build-tools\19.1.0
So when i am trying to rebuild, i get exactly the same error message as before. Additionally, i had installed Android SDK Build tools rev 22.0.1, and i get warning saying update targetSdkVersion to 22.
Could please someone help me with this?
PS: Sorry for the very long post, and maybe for the many unnecessary details, but i am new in Android Dev.
Thank you
cinsa said:
I am trying to import some libraries, in Android Studio. I had the following error message: Error:The SDK Build Tools revision (17.0.0) is too low for project ':actionbarsherlock'. Minimum required is 19.1.0
So i installed Android SDK Build tools rev 19.1.0. I modified build.gradle file (app) looking like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.example.xx.xx"
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "1.2"
}
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:19.1.0'
compile 'com.android.support:support-v4:19.1.0'
compile project(':actionbarsherlock')
compile project(':actionbarsherlock-fest')
compile project(':actionbarsherlock-i18n')
}
Also in Run/Debug Configurations, under App Engine DevAppServer, i set in App Engine SDK field the path for the new SDK, looks like that: C:\Users\cami\AppData\Local\Android\sdk\build-tools\19.1.0
So when i am trying to rebuild, i get exactly the same error message as before. Additionally, i had installed Android SDK Build tools rev 22.0.1, and i get warning saying update targetSdkVersion to 22.
Could please someone help me with this?
PS: Sorry for the very long post, and maybe for the many unnecessary details, but i am new in Android Dev.
Thank you
Click to expand...
Click to collapse
Try change "buildToolsVersion '19.1.0'" to "buildToolsVersion '22.0.0'" Pay attention that you should have installed build tools 22 in your SDK Manager.
It should help.

Error:duplicate files during packaging of APK

I clean and rebuild my project with success but when i run it, it gives me an error. I tried many solution but i couldn't solve with them.
This is my error :
Code:
Error:duplicate files during packaging of APK /Users/ege/AndroidStudioProjects/projectandroid/projectAndroid/build/outputs/apk/projectAndroid-debug-unaligned.apk
Path in archive: AndroidManifest.xml
Origin 1: /Users/ege/AndroidStudioProjects/projectandroid/projectAndroid/build/intermediates/resources/resources-debug.ap_
Origin 2: /Users/ege/AndroidStudioProjects/projectandroid/projectAndroid/build/intermediates/javaResources/debug/AndroidManifest.xml
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'AndroidManifest.xml'
}
}
Error:Execution failed for task ':projectAndroid:packageDebug'.
Duplicate files copied in APK AndroidManifest.xml
File 1: /Users/ege/AndroidStudioProjects/projectandroid/projectAndroid/build/intermediates/resources/resources-debug.ap_
File 2: /Users/ege/AndroidStudioProjects/projectandroid/projectAndroid/build/intermediates/javaResources/debug/AndroidManifest.xml
This is my build gradle:
Code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '23.0.0 rc2'
defaultConfig {
applicationId "com.project.android"
minSdkVersion 14
targetSdkVersion 19
multiDexEnabled true
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "2g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
packagingOptions {
exclude 'AndroidManifest.xml'
}
}
}
dependencies {
compile project(':slidingMenuLibrary')
compile project(':pullToRefreshLibrary')
compile project(':placeActivity')
compile project(':jMC')
compile project(':salesforceSDK')
compile project(':library')
compile files('../libMaster/android-integration-2.3-SNAPSHOT.jar')
compile files('../libMaster/com.radaee.pdfex_view.jar')
compile files('../libMaster/core-2.3-SNAPSHOT.jar')
compile files('../libMaster/ksoap2-android-assembly-3.2.0-jar-with-dependencies.jar')
compile files('../libMaster/libGoogleAnalyticsServices-v3.01.jar')
compile files('../libMaster/urbanairship-lib-3.0.0.jar')
compile 'com.google.api.client:google-api-client-repackaged-com-google-common-base:1.2.3-alpha'
compile 'com.google.code.gson:gson:2.3.1'
compile ('com.android.support:support-v4:22.2.0'){
exclude group: 'multidex'
}
compile files('../libMaster/commons-lang3-3.1.jar')
compile files('../libMaster/aws-android-sdk-1.4.4-s3.jar')
compile files('../libMaster/aws-android-sdk-1.4.4-core.jar')
compile files('../libMaster/universal-image-loader-1.8.5-with-sources.jar')
}
I also tried this solution, but didn't work :
Code:
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}

Getting java.util.zip.ZipException: duplicate entry for SimpleJavaMail

While building apk for my project, I'm getting the following error:
Code:
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/simplejavamail/email/AttachmentResource.class
Here's my gradle file:
Code:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
applicationId "com.parassidhu.cdlumaths"
minSdkVersion 16
targetSdkVersion 24
versionCode 2
versionName "1.1"
multiDexEnabled true
}
dexOptions {
incremental true
javaMaxHeapSize "8g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:8.0.1'
compile 'com.github.paolorotolo:appintro:3.4.0'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.hotchemi:android-rate:1.0.1'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'org.simplejavamail:simple-java-mail:4.1.1'
compile files('libs/simple-java-mail-4.1.1.jar')
}
apply plugin: 'com.google.gms.google-services'
I
I have no idea what's wrong. I can test the app fine but when I Rebuild project/build apk/generate signed apk, I get this error. Sometimes the duplicate entry points to different class than AttachmentResource.class.

Unable to resolve all dependencies in android studio 3.0

I am getting these errors while syncing gradle:-
Error:Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.
Error:Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve com.android.support:design:26.1.0.
Error:Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve com.android.support.test:runner:1.0.1.
Error:Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve junit:junit:4.12.
Error:Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve com.android.support.test.espresso:espresso-core:3.0.1.
METHODS TRIED
i have tried adding GOOGLE MAVEN REPO, mavencentral all with url & without url.
i have tried deleting .gradle folder from C:\Users\<username>/.gradle.
i have tried gradle offline work and online work, both end up with same error message.
tried clean project & rebuilding.
tried INVALIDATE CACHE & RESTART.
tried degrading the android studio version.
I AM USING WINDOWS 64BIT WITH 4GB OF RAM AND DUAL CORE 2.0 GHZ PROCESSOR, AND ANDROID VERSION 3.0, GRADLE VERSION 4.1 & 4.3(LATEST), I HAVE INSATLLED ALL THE NECESSARY TOOLS & EVERYTHING UPDATED IN SDK MANAGER. ANDROID SUPPORT REPOSITORY & GOOGLE OFFLINE REPOSITORY BOTH INSTALLED.
WHENEVER I TRY TO SYNC IT WITH OFFLINE WORK IT END UP WITH ERROR (NO CACHED VERSION OF THIS (DEPENDENCY IS FOUND), AND WHENEVER I TRY TO SYNC WITH ONLINE WORK, THE ERRORS ARE SAME LISTED ABOVE IN BOTH CASES.
I HAVE TRIED EVERYTHING FROM STACK OVER FLOW & YOUTUBE.
BUILD.GRADLE PROJECT:MY APPLICATION.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
BUILD.GRADLE MODULE:APP
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.vipinsaini.myapplication"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.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'
}
CAN ANYONE PLZ HELP ME SOLVE THIS ISSUE. I am new to android studio plz omit mistakes.
Add google() to allprojects node in your root build.gradle file
allprojects {
repositories {
jcenter()
google()
}
}
Hey,
I have a same problem. I tried to do your solution, but already exist this code in build.gradle file.
I will be happy to another solution.
Thanks.
Try to Invalidate Cache/Restart that got the problem fixed for me
Unable to Resolve Dependencies
After much research and headache... Go to File\Settings\Gradle. Deselect the "Offline work" box. Now you can connect and download any necessary or missing dependencies.
Worked, thank you.
i tried invalidate and restart then delete .gradle file then uncheck the offline work but no use not clear the appcompact error

Categories

Resources