Error after importing a module in Android Studio - java

i've a problem after importing a module in an existing project because after adding the dependencies these errors appears:
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve project :RemoteSupport+.
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve project :RemoteSupport+.
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve project :RemoteSupport+.
Show Details
Affected Modules: app
I've already tried to delete the .idea, . gradle files and invalidate Caches/Restart
This is the build.gradle of the app module:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
compileSdkVersion 'Vuzix Corporation:Vuzix M300 SDK:23'
defaultConfig {
applicationId "com.mtmproject.aures"
minSdkVersion 23
targetSdkVersion 27
versionCode 4
versionName "1.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
doNotStrip '*/armeabi-v7a/*.so'
doNotStrip '*/x86/*.so'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:support-v4: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.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.code.gson:gson:2.8.5'
// FIREBASE
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.2'
implementation 'com.google.firebase:firebase-database:16.0.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation project(path: ':MTMProject')
}
This is the build gradle of the imported module (RemoteSupport):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
sourceSets.main {
jniLibs.srcDir 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
defaultConfig {
applicationId "org.appspot.apprtc"
minSdkVersion 16
targetSdkVersion 26
versionCode 15663
versionName "r15663"
testApplicationId "org.appspot.apprtc.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation files('libs/audio_device_java.jar')
implementation files('libs/autobanh.jar')
implementation files('libs/base_java.jar')
implementation files('libs/libjingle_peerconnection.jar')
}

Related

Can't access class files from project which I imported as a library

I imported a project as a library in my base project but I am not able to access the class files present in my imported library , in my base project. Forgive me if the question is stupid , I am relatively new in android studio
Steps I did -
Changed apply plugin: 'com.android.application' to apply plugin: 'com.android.library'
Added Implementation project(':project_name')
Changed the compileSdkVersion, minSdkVersion and targetSdkVersion to the same values
Did an Invalidate Cache / Restart
Following are my gradle files
build.gradle(:app) (Main Project)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.consensus.deg_project"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:25.12.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth:19.4.0'
implementation 'com.google.firebase:firebase-firestore:22.0.0'
implementation 'com.google.android.gms:play-services-auth:18.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
exclude group:'com.google.guava'
}
implementation('com.google.apis:google-api-services-sheets:v4-rev506-1.23.0') {
exclude group: 'org.apache.httpcomponents'
exclude group:'com.google.guava'
}
implementation 'com.shobhitpuri.custombuttons:google-signin:1.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment:2.3.1'
implementation 'androidx.navigation:navigation-ui:2.3.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation 'com.android.volley:volley:1.1.1'
implementation 'pub.devrel:easypermissions:0.3.0'
implementation project(':TF_Lite')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
build.gradle(:TF_Lite) (Project imported as a library)
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
applicationId "org.tensorflow.lite.examples.classification"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress "tflite"
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
lintOptions {
abortOnError false
}
flavorDimensions "tfliteInference"
productFlavors {
// The TFLite inference is built using the TFLite Support library.
support {
dimension "tfliteInference"
}
// The TFLite inference is built using the TFLite Task library.
taskApi {
dimension "tfliteInference"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
supportImplementation project(":lib_support2")
taskApiImplementation project(":lib_task_api2")
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'com.google.truth:truth:1.0.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
}
So all i had to do was add this:-
flavorDimensions "tfliteInference"
productFlavors {
// The TFLite inference is built using the TFLite Support library.
support {
dimension "tfliteInference"
}
// The TFLite inference is built using the TFLite Task library.
taskApi {
dimension "tfliteInference"
}
}
in my main project's build gradle

ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.1.0

I am trying to create a project in the android studio. But every time i find the following gradle error
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.1.0.
Show Details
Affected Modules: app
I have solved the proxy problem and also unchecked the offline work option. Please help me in this regard.
I have the following dependencies.
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.buraqht"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

Android: Unable to resolve dependency

I'm new to using Android Studio and basically I'm having problem with my dependencies I've tried upgrading my gradle plugin version to 3.5.1 and my gradle version to 5.4.1 and still nothing happened. I basically have 2 projects in my workspace one is the nerarosbridgeclient which is my library and the robot utility which is my main application..
here is my ERROR:
Unable to resolve dependency for ':robotutility#debug/compileClasspath': Could not resolve project :nerarosbridgeclient.
Unable to find a matching configuration of project :nerarosbridgeclient:
- None of the consumable configurations have attributes. Could not resolve
project :nerarosbridgeclient. Required by: project :robotutility Caused
by:org.gradle.internal.component.NoMatchingConfigurationSelectionException:
Unable to find a matching configuration of project :nerarosbridgeclient:
- None of the consumable configurations have attributes.
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
}
My 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')
}
And my settings.gradle
include ':robotutility', ':nerarosbridgeclient'
my LIBRARY build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-
optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.neovisionaries:nv-websocket-client:2.9'
}
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
}
}

How to resolve firebase build faild error?

I tried making a chatapp with firebase, but when i try to run the app on an emulator i get this "Error: Type com.google.firebase.FirebaseApp$zza is referenced as an interface from com.google.android.gms.internal.zzbkv$3."
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.firebasechat"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.7'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation 'com.firebaseui:firebase-ui:1.1.1'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
}
apply plugin: 'com.google.gms.google-services'
classpath 'com.google.gms:google-services:4.0.1'
check declare plugin in gradle module. and define classpath to project gradle

TransformException: java.util.zip.ZipException: duplicate entry: android/support/design/widget/CoordinatorLayout$1.class

I am getting this error while generating the signed apk.Even i tried many solutions but no one is works for me.
Please Help me:
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/design/widget/CoordinatorLayout$1.class
and my gradle file code is
Build.gradle is here please tell me what is my error for generating signed apk:-
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.google.com' }
}
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id: "MyKey", onesignal_google_project_number: "REMOTE"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
implementation 'com.android.support:multidex:1.0.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:support-v4:27.0.1'
implementation 'com.google.android.gms:play-services:12.0.0'
implementation 'com.android.support:cardview-v7:27.0.1'
implementation 'com.android.support:recyclerview-v7:27.0.1'
compile 'com.android.support:design:27.0.1'
compile 'com.wang.avi:library:2.1.3'
compile 'com.github.rey5137:material:1.2.4'
compile 'com.onesignal:OneSignal:[3.8.3, 3.99.99]'
}
your one of dependency has different version of android support library.force the version in build.gradle root with
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.0.1'
force 'com.android.support:design:27.0.1'
force 'com.android.support:appcompat-v7:27.0.1'
}
}

Categories