I've started a new project in Android Studio and I want to import the zxing-android-embedded to allow me to create a simple barcode scanner within my application.
Here is the build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.android.barcodescanner"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.zxing:core:3.2.1'
compile 'com.journeyapps:zxing-android-embedded:3.2.0'
}
It Shows Error that
Error:(29, 13) Failed to resolve: com.google.zxing:core:3.2.1
Disable offline mode and sync project<br>Show in File<br>Show in Project Structure dialog
and
Error:(30, 13) Failed to resolve: com.journeyapps:zxing-android-embedded:3.2.0
Disable offline mode and sync project<br>Show in File<br>Show in Project Structure dialog
Well, I searched Stack Overflow but was unable to find the latest Dependency ZXing android embedded.
try this:
dependencies {
compile 'com.journeyapps:zxing-android-embedded:3.5.0'
compile 'com.android.support:appcompat-v7:23.1.0'
}
Related
I'm new at android. I'm trying to add Google sign in feature in my app but when i add com.google.android.gms:play-services-auth:17.0.0 in my build.gradle file,
i'm getting following this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: androidx/versionedparcelable/CustomVersionedParcelable.class
Kindly suggest solution, i spend whole day but cant get solution.
Build.gradle code is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.1"
defaultConfig {
multiDexEnabled true
applicationId "com.example.mawai.smartlearn"
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 {
compile 'com.android.support:multidex:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-auth:17.0.0'
}
In version 17.0.0 and above, you need to use AndroidX, so you have 2 options:
1) Downgrade com.google.android.gms:play-services-auth to older version
2) Add/Migrate AndroidX to your app (Recommended)
Check this link for migration
this is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.villegas.juliana.dreavel_app"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
when i copy the picasso dependency it throws this error in this line
compile 'com.android.support:appcompat-v7:23.4.0'
error : All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 24.0.0, 23.4.0. Examples include com.android.support:support-v4:24.0.0 and com.android.support:animated-vector-drawable:23.4.0 more... (Ctrl+F1)
I am currently developing an android app and implementing in-app purchases.
My application runs fine in simulator mode, but when I try to build an APK I get this following error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/android/vending/billing/IInAppBillingService;
I'm not sure what is the exact cause, but here are my libraries I am using (IAP library):
Libraries
Lastly, this is my Gradle build which I did set up to compile the library correctly:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "flarehubpe.xflare.flarehub"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.anjlab.android.iab.v3:library:1.0.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
testCompile 'junit:junit:4.12'
}
What am I doing wrong?
In my build.grade, when I put in the code:
apply plugin: 'com.google.gms.google-services'
An error comes up that says:
Error:(35, 0) Plugin with id 'com.google.gms.google-services' not found.
Why is this?? Its messing up my entire project. Here is my gradle code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.apps.stephenshettler.laughsoundboard"
minSdkVersion 16
targetSdkVersion 24
versionCode 4
versionName "2.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-ads:9.6.1'
compile 'com.google.firebase:firebase-ads:9.6.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-appindexing:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
Help is greatly appreciated! Thanks!
Have you added this in the project's build.gradle
classpath 'com.google.gms:google-services:1.3.0'
When it comes to cannot resolve the symbol 'R', Simply clean or Rebuild the project or Invalidate/Restart like Firdoesh mentioned.
For this you can try putting compile 'com.google.android.gms:play-services-analytics:9.2.1' this in gradle, it does the same job.
and for R go to File > Invalidate/Restart
The project is one of Google samples on Github, Androidtv-Leanback. I cloned it and opened with Android studio, but build fails.
Error:
Could not find support-v4.aar(com.android.support:support-v4:24.1.1)
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24'
defaultConfig {
applicationId "com.example.android.tvleanback"
minSdkVersion 21
targetSdkVersion 24
versionCode 2
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:leanback-v17:24.1.1'
compile 'com.android.support:recommendation:24.1.1'
compile 'com.android.support:preference-leanback-v17:24.1.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.robolectric:robolectric:3.1'
androidTestCompile 'com.android.support:support-annotations:24.1.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
compile 'com.google.android.exoplayer:exoplayer:r1.5.8'
// compile files('src/libs/android-support-v4.jar')
}
add this dependency in your build.gradle file
dependencies {
...
compile "com.android.support:support-v4:24.2.1"
}
and make sure you have downloaded the android support repository using sdk manager.