Added two custom zxing and zbar libraries for reading and generating barcodes via File>New> Jar.file added them after in Project Structure too added them and chose implementation in all already open questions compile is used but in android studio it is no longer instead of it implementation and api how to add them correctly?
build.gradle (app)
apply plugin: 'com.android.application'
check.dependsOn 'assembleDebugAndroidTest'
android {
compileSdkVersion 28
flavorDimensions "minSdkVersion"
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
'android.support.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:28.0.0'
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
// Firebase Authentication
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation project(':zbar')
implementation project(':zxing_core')
}
apply plugin: 'com.google.gms.google-services'
build.gradle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'd suggest to use dependencies from here https://mvnrepository.com/artifact/com.google.zxing but in your case (as long as you're adding jars), you can plug them in via implementation fileTree(include: ['*.jar'], dir: 'libs') in build.gradle (libs to be replaced with whatever folder they landed into).
Related
I added crashlytics in my android app following the steps in here
when I go to the page of crashlytics in firebase console, the page still appears like this
I don’t know whats next ? I configured things in my app and run it, and make some crashes and still the page is like this.
I tried to uninstall and install the app and refreshed the page
so maybe I did the configuration wrong
here is my build.gradle (app)
apply plugin: 'com.android.application'
//apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.myapp.myappandroid"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
debuggable false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
testOptions.unitTests.includeAndroidResources = true
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.cesards.android:cropimageview:1.0.2.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'me.dm7.barcodescanner:zbar:1.8.4'
implementation 'com.scottyab:rootbeer-lib:0.0.7'
implementation 'id.zelory:compressor:2.1.0'
api 'com.google.android.material:material:1.3.0-alpha01'
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
implementation 'com.google.firebase:firebase-core:17.5.1'
///here I add the crashlytics
implementation platform('com.google.firebase:firebase-bom:25.12.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-messaging:20.1.6'
//noinspection GradleCompatible
implementation 'com.android.support:design:23.2.1'
implementation 'com.ismaeldivita.chipnavigation:chip-navigation-bar:1.3.1'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.70'
}
and this is my build.gradle (myappandroid)
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath 'com.google.gms:google-services:4.3.4'
// classpath 'io.fabric.tools:gradle:1.31.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
please tell me what I am doing wrong or what I missed ? thanks in advance
I'm new to using android studio and basically I'm having a problem with my dependencies I'm not sure what happened but I've tried updating my gradle plugin version to 3.5.1 and the gradle version to 5.4.1 and still nothing happened. Also I've tried updating my SDK but its still giving me the same error.
ERROR:
ERROR: Unable to resolve dependency for ':robotutility#debug/compileClasspath': Could not resolve project :nerarosbridgeclient.
Here is my Build.Gradle Project:
// 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.5.1'
// 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:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.1"
defaultConfig {
applicationId 'com.nerarobotics.robotutility'
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//noinspection DuplicatePlatformClasses
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.jaredrummler:material-spinner:1.3.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation project(path: ':nerarosbridgeclient')
}
Settings.gradle
include ':robotutility', ':nerarosbridgeclient'
Thanks in advance!
Probably project nerarosbridgeclient is not included in your settings.gradle or project missing in your workspace. Please check and update.
Add this line in settings.gradle if missing:
include ':nerarosbridgeclient'
Since adding Firebase to my application so I can send push notifications to users through appcenter I have encountered a number of problems.
I am currently experiencing a possible merging issue between two libraries.
Failed to notify dependency resolution listener.
The library com.google.android.gms:play-services-basement is being
requested by various other libraries at [[15.0.1,15.0.1]], but
resolves to 16.0.1. Disable the plugin and check your dependencies
tree using ./gradlew :app:dependencies.
As you can see here I do not have any specific dependencies for play-services-basement...
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'io.realm:realm-gradle-plugin:5.3.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
apply plugin: 'com.google.gms.google-services'
realm {
syncEnabled = true
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.xxxxsoftware.xxxx.xxxx"
minSdkVersion 16
targetSdkVersion 28
versionCode 36
versionName "2.8.17"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4#aar') {
transitive = true
}
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
def appCenterSdkVersion = '1.9.0'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-push:${appCenterSdkVersion}"
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.zxing:core:3.3.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
implementation 'com.github.delight-im:Android-SimpleLocation:v1.0.1'
implementation 'io.nlopez.smartlocation:library:3.3.3'
implementation 'io.realm:android-adapters:3.0.0'
implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.3'
implementation 'com.journeyapps:zxing-android-embedded:3.1.0#aar'
implementation 'com.github.pwittchen:reactivenetwork-rx2:2.0.0'
}
I have ran the command ./gradlew :app:dependencies and it prints out:
* What went wrong:
Project 'app' not found in root project 'ChimePassportAndroid'.
In order to use Firebase messaging, you need to add in your build.gradle file the corresponding dependency like this:
implementation 'com.google.firebase:firebase-messaging:17.3.4'
And your problem will be solved.
when i added the firebase functions library (implementation 'com.google.firebase:firebase-functions:16.1.0') , android studio(3.1.4) throws "Unable to resolve dependency for ':app#debug/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)"
I tried to add "implementation files('libs/okhttp-2.7.2.jar')" but still got the same error.
this is my build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.caliber.mskhan.calibergaming"
minSdkVersion 16
targetSdkVersion 27
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.firebase:firebase-functions:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.karumi:dexter:4.2.0'
//implementation files('libs/okhttp-2.7.2.jar')
}
apply plugin: 'com.google.gms.google-services'
this is my build.gradle(project)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build errors after gradle sync
Change this
// 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.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.google.firebase:firebase-plugins:1.0.4'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Ref: not-able-to-import-com-squareup-okhttp-okhttpclient
Gradle should have a line like this
compile 'com.squareup.okhttp3:okhttp:3.0.1'
and this is how you import it
import okhttp3.OkHttpClient;
Because OkHttpClient has been moved from package com.squareup.okhttp to okhttp3 in the last version.
More details are here and here
change classpath
classpath 'com.google.gms:google-services:4.0.1'
to
classpath 'com.google.gms:google-services:4.2.0'
its working with me
I just updated my CompileSDKVersion and TargetSDK Version to 27, and updated the dependencies accordingly, and now my app won't run, it's getting this error:
Program type already present: com.android.vending.billing.IInAppBillingService
Message{kind=ERROR, text=Program type already present: com.android.vending.billing.IInAppBillingService, sources=[Unknown source file], tool name=Optional.of(D8)}
I'm using a billing library called checkout. I've tried reverting back to 26 and disabling certain dependencies but nothing seems to work.
My App Level Build.Gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "me.paxana.cwnet"
minSdkVersion 16
targetSdkVersion 27
versionCode 9
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.android.gms:play-services-ads:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:gridlayout-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.squareup.okhttp3:okhttp:3.9.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-ads:15.0.0'
implementation 'com.google.firebase:firebase-crash:15.0.0'
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
implementation 'com.firebaseui:firebase-ui-database:3.0.0'
implementation 'org.solovyev.android:checkout:1.2.1'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.29.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.daimajia.slider:library:1.1.5#aar'
implementation 'me.zhanghai.android.materialratingbar:library:1.2.0'
implementation 'com.squareup.moshi:moshi:1.5.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true
}
implementation 'com.anthonymandra:ToggleButtons:2.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.mikepenz:iconics-core:3.0.3#aar'
implementation 'com.mikepenz:fontawesome-typeface:5.0.6.0#aar'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
my project level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
maven {
url 'https://maven.fabric.io/public'
}
maven { url 'https://repo.spring.io/plugins-snapshot' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.2.1'
classpath 'io.fabric.tools:gradle:1.24.4'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.BUILD-SNAPSHOT'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}