Android things error: unable to merge dex - android

i am doing project on motion sensor camera using android things and firebase and notification through mobile
Error:Execution failed for task
':mobile:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
i add "multidexenabled true" but no solution
this is App level gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "za.co.riggaroo.motioncamera"
minSdkVersion 27
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //Added this
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
ext {
archVersion = '1.1.0'
playServices = "11.8.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.google.firebase:firebase-core:${playServices}"
implementation "com.google.firebase:firebase-database:${playServices}"
implementation "com.google.firebase:firebase-storage:${playServices}"
implementation "com.google.firebase:firebase-auth:${playServices}"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
implementation "com.android.support:animated-vector-drawable:27.1.0"
implementation "com.android.support:support-v4:27.1.0"
implementation "com.android.support:support-media-compat:27.1.0"
implementation "com.android.support:cardview-v7:27.1.0"
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
compileOnly 'com.google.android.things:androidthings:0.7-devpreview'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "android.arch.lifecycle:runtime:${archVersion}"
implementation "android.arch.lifecycle:extensions:${archVersion}"
annotationProcessor "android.arch.lifecycle:compiler:${archVersion}"
implementation "com.android.support:appcompat-v7:27.1.0"
compile 'com.android.support:support-vector-drawable:27.1.0'
}
apply plugin: 'com.google.gms.google-services'

Related

e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:

supertypes of the following classes cannot be resolved. please make sure you have the required dependency in the classpath : class com.google.firebase.auth.internal.internalAuthProvider , unresolved supertypes
com.google.firebase.internal.internalTokenProvider
Here is the code:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.firebaseuiexample"
minSdkVersion 29
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.2'
}
apply plugin: 'com.google.gms.google-services'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-auth:16.0.5'
change to these implementations.

"Unresolved Reference: Interpreter" error for Tensorflow Lite Interpreter

I am getting the error: "Unresolved reference: Interpreter" for the line
import org.tensorflow.lite.Interpreter
My Gradle build is 3.2.1 and Android Studio version 3.4.2
Below is the App build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "org.tensorflow.lite.examples.posenet"
minSdkVersion 27
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 project(":posenet")
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'org.tensorflow:tensorflow-lite:+'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

Failed to resolve: androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1

I'm trying to use the new Navigation Architecture Component for android and I'm getting the error
Failed to resolve: androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1
when I'm defining the lifecycle_version to "1.1.1"
I'm basically just copying and pasting what is in the documentation so I'm running out of ideas of what is wrong in here :(
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.mobile.codgin.newnavigation"
minSdkVersion 21
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 {
def lifecycle_version = "1.1.1"
// ViewModel and LiveData
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
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'
}
try replace
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
with this
//https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-viewmodel-ktx
implementation group: 'androidx.lifecycle', name:'lifecycle-viewmodel-ktx', version: '2.0.0-alpha1'
then sync again.
You can have a look here :
https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-viewmodel-ktx/2.0.0-alpha1
it seems to be that the repository was emptied somehow. Hence, you can not download it from the repository.
When it shows you this error add this code to section build.gradle
configurations {
all {
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
}
}

Error implementing Material Design in Android

I've been reading over the new material design website but I'm having an issue implementing it.
The application I'm currently working in is a simple test applications with nothing more than a button and some textviews.
The problem comes after placing implementation 'com.google.android.material:material:1.0.0-alpha1' in the gradle file.
heres my build.gradle(app) file
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.user.firebasemessagingtest"
minSdkVersion 19
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(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
implementation 'com.google.firebase:firebase-ml-vision:15.0.0'
implementation 'com.google.android.material:material:1.0.0-alpha1'
}
apply plugin: 'com.google.gms.google-services'
I've got 4 errors,
error: resource android:attr/dialogCornerRadius not found.
error: resource android:attr/fontVariationSettings not found.
error: resource android:attr/ttcIndex not found.
error: failed linking references.
I have included the maven in the project gradle file like stated in the documentation.
Try this
change compileSdkVersion and Support Libraries version
compileSdkVersion 'android-P'
Support Libraries to '28.0.0-alpha1'
and use
api 'com.android.support:design:28.0.0-alpha1'
EDIT
Update your SDK Platform update - Android P Preview (latest)
and also make targetSdkVersion 'P'
Than Clean-Re_Build-Run your project
EDIT 2
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "com.example.nilesh.testapp"
minSdkVersion 19
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'
}
}
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
compile 'com.android.support:design:28.0.0-alpha1'
compile 'com.android.support:cardview-v7:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.material:material:1.0.0-alpha1'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
implementation 'com.google.firebase:firebase-ml-vision:15.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
repositories {
mavenCentral()
}
Hope this helps
Set compileSdkVersion as 'android-P'.Match the support library with the compileSdkVersion. For instance, implementation 'com.android.support:support-v4:28.0.0-alpha1' instead of implementation 'com.android.support:appcompat-v7:27.1.1'.
Replace implementation 'com.google.android.material:material:1.0.0-alpha1' with api 'com.android.support:design:28.0.0-alpha1'.
The app build.gradle should look something like this.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "com.wolfrevokcats.myapp"
minSdkVersion 15
targetSdkVersion 27
versionCode 16
versionName "2.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable false
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
api 'com.android.support:design:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
implementation ('com.someone.addons:library:1.6.1#aar'){
exclude group: 'com.android.support'
exclude module: 'appcompat-v7'
exclude module: 'support-v4'
}
implementation 'com.google.android.gms:play-services-location:15.0.1'
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'
}
As 'com.android.support:design:28.0.0-alpha1' is being used, our code will have to change to android.support.design instead of com.google.android.material libraries. Here's an example using the new Bottom App Bar widget.
<android.support.design.bottomappbar.BottomAppBar
android:id="#+id/toolbar"
style="#style/Widget.MaterialComponents.BottomAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:fabAttached="true"
app:fabAlignmentMode="center"/>

Error in using ArthurHub image crop library with kotlin

I am using ArthurHub image crop library in my project. but this error occurs
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
i have tried many solutions that were provided in other questions, but none of them works for me.
my build.gradle(module) file is here
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.lenovo.chatapp"
minSdkVersion 19
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:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:12.0.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.firebase:firebase-database:12.0.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'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
implementation 'com.google.firebase:firebase-core:12.0.0'
}
repositories {
mavenCentral()
}
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

Categories

Resources