I have tried to import multiple libary for project in android studio.But it always shows error like
For this, I tried multiple solution like sdk update , studio update , build.gradle update and so on.Eventhough, i could not get any result.anyone give solution please.
Herewith I mentioned my gradle sepcification too.
app - build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.abof.android"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services:7.5.0'
compile files('libs/volley.jar')
compile 'com.android.support:appcompat-v7:22.2.0'
compile project(':libraries:facebookV2')
compile files('libs/httpcore-4.3-beta1.jar')
compile files('libs/httpmime-4.3.5.jar')
compile project(':libraries:gson-2.2.4')
compile project(':libraries:citruslibrary')
}
project - 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.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Related
I am trying to import a project in android Studio but if Fails
Following is the project:
project
I get this error:
> C:\xampp\htdocs\freedom\Android-IP-Camera-master\spydroid-ipcamera-master\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
> Error:(3) Error retrieving parent for item: No resource found that
> matches the given name 'android:Widget.Material.Spinner.Underlined'.
> Error:(3) Error retrieving parent for item: No resource found that
> matches the given name 'android:Widget.Material.Spinner.Underlined'.
> C:\xampp\htdocs\freedom\Android-IP-Camera-master\spydroid-ipcamera-master\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
> Error:(17) Error retrieving parent for item: No resource found that
> matches the given name 'android:TextAppearance.Material.Inverse'.
EDIT:
Below are both gradle files of the project.
build.gradle (Module:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "net.majorkernelpanic.spydroid"
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')
}
build.gradle(Project: spydroid-ipcamera-master):
// 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.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
First of all change
compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')
to compile fileTree(include: ['*.jar'], dir: 'libs')
second try to use the app combat library, cause some resources are missing
compile 'com.android.support:appcompat-v7:25.4.0'
or you can up your compileSdkVersion && targetSdkVersion to 21+
I import related project and chages some thing in build.gradle to last version that recomended by AS.
Change your build.gradle (Module:app) with this and try:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "net.majorkernelpanic.spydroid"
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.android.gms:play-services:11.0.0'
compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')
}
In my case project sync and run perfectly.
UPDATE:
I'll add that you must also change deprecated apache HttpClient with the new HttpURLConnection.
For this purpose add below code to your build.gradle (Module:app) : useLibrary 'org.apache.http.legacy'
I'm using Android Studio 2.1.2 and it is giving error "Error:(29, 17) Failed to resolve: junit:junit:4.12" Similar error for any third party library. I have tried removing and adding the junit library from Project Settings but still it giving same error. I'm not sure whether this proxy issue? I have checked connection from Studio for maven link and it is showing successful. Following is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
defaultConfig {
applicationId "com.example.administrator.myapplication"
minSdkVersion 17
targetSdkVersion 24
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:24.0.0'
}
Project Level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
repositories {
jcenter()
mavenCentral()
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please let me know if I'm missing something and how to resolve this.
After lot of efforts I was able to resolve this issue. Issue lies with the proxy settings, I have added following lines in gradle.properties file and gradle synced successfully with dependencies resolved
systemProp.http.proxyHost=x.x.x.x
systemProp.https.proxyPort=xxxx
systemProp.https.proxyHost=x.x.x.x
systemProp.http.proxyPort=xxxx
Creating an app that has two productFlavors paid and free. Now since I use Google play services for Ads, its giving a very hard time throwing errors one by one, I've been searching on this one for the whole day, and it seems the root cause is the difference in version of play services specified in my gradle.
At the moment, this is the error I obtain:
Error:Execution failed for task
':app:transformClassesWithJarMergingForPaidRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/internal/zzkb.class
Answers to similar question point to cross check if similar .jars exist. However I tried my best and I am helpless.
This is my app level build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.udacity.gradle.builditbigger"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
free {
applicationId = "com.udacity.gradle.builditbigger.free"
}
paid {
applicationId = "com.udacity.gradle.builditbigger.paid"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Added for AdMob
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.firebase:firebase-ads:9.0.2'
compile project(path: ':backend', configuration: 'android-endpoints')
compile project(path: ':joketeller')
}
apply plugin: 'com.google.gms.google-services'
And this is my top level build.gradle file :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Desperate to fix this, any help will be highly appreciated, Thanks!
I'm trying to build a project with the ZXing library. I used the instructions in this post to integrate the library into my Android project and I believe I have done that successfully. However, when I try to build the entire project, there is an error in the Gradle build that refers to a dependency or something similar. However, I think I've already solved all the issues with dependencies.
The returned error in Gradle :
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:prepareDebugDependencies'.
The message is
Dependency QRR:android:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency.
Here is the full Gradle log using Stacktrace.
EDIT:
In this project, I used the full ZXing library, not the Embedded or the Minimal.
After the download of the full repo of ZXing here, I've added the android folder as a new Module of the project. I've added the dependency on the Gradle file. Then, I've dowloaded the core on the Maven repo, then I imported it as JAR Library. I've added the dependency in the android:build-gradle.
The app:build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.mehdi.qrr"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile project(':android')
compile 'com.google.zxing:core:3.2.1'
}
repositories {
jcenter()
}
The Project:build-gradle is:
// 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
}
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/journeyapps/maven"
}
}
The android:build-gradle (Gradle file of the ZXing project):
apply plugin: 'com.android.application'
android {
signingConfigs {
}
compileSdkVersion 21
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.google.zxing.client.android"
minSdkVersion 15
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.google.zxing:core:3.2.1'
}
hello i want create a android apk.
and need to use from "com.mcxiaoke.volley" and "com.android.support:appcompat"
please give me a build app for my app.
current build app is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
//buildToolsVersion "23.0.2"
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "boxweb.asia.shopcenter"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.volley:volley:1.0.0'
}
but don't work and show error.
error is : http://up.vbiran.ir/uploads/45106145544003944084_Untitled-1.jpg
i can not download "https://jcenter.bintray.com/com/android/volley/volley/1.0.0/volley-1.0.0.pom" in android-studio but can download in browser.
help me to install plugin from file.
please help me
Adding volley support can done just by adding compile 'com.mcxiaoke.volley:library:1.0.19 to gradle.build dependencies module.
dependencies
{
compile 'com.mcxiaoke.volley:library:1.0.19'
}
Go through Android Volley Library
Make sure you have jcenter() in your dependencies. So your build.gradle should have:
repositories {
jcenter()
}
dependencies {
compile 'com.android.volley:volley:1.0.0'
}
Note:
The repositories block can either be in your root build.gradle or your app/build.gradle.