okay, so this is the first time I'm working with SDKs,
I'm using the zoom SDK from here https://marketplace.zoom.us/docs/sdk/native-sdks/android/getting-started
and I'm trying to run the sample APK as mentioned in the documentation and it returns the error
"This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled"
https://i.stack.imgur.com/taM6c.png
and I have searched and found a solution to this where I turn the android project into an androidX project by using the following in the Gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
HERE IS WHERE THE ISSUE LIES
the SDK doesn't have any Gradle.properties file, and hence i don't know where to insert the above code
for now, I have inserted the above code in the following files: https://i.stack.imgur.com/Ktj4j.png
and yet the issue still exists, can I please get some help on this? thanks in advance!
Added this into gradle.properties files solve my problem.
android.useAndroidX=true
android.enableJetifier=true
Create new project that time no need to convert AndroidX. Add this in gradle, hopefully working.
Application level
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation files('libs/commonlib.aar')
implementation files('libs/mobilertc.aar')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.3.0-alpha02'
}
Project Level
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
The gradle.properties file's name should be lowercase and you can place it multiple location, see the official documentation here.
In this case, I guess you have to put it to your project root directory.
Added this into gradle.properties files
android.useAndroidX=true
android.enableJetifier=true
if you did not find this file write in the terminal flutter create . to recreate your project after that you are going to see gradle.properties file with the same properties that I mintioned before.
Related
I want to add ads to my project but when i add the line below, it doesn't work:
implementation 'com.google.android.gms:play-services-ads:18.1.0'
these are the dependencies from the build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.gms:play-services-ads:18.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
It is likely, that you might not have added the Google Services Gradle Plugin to the project, as well as the google-services.json file (which can be downloaded from the Firebase console) - and so your application fails to authenticate.
Adding the com.google.android.gms.ads.APPLICATION_ID into the AndroidManifest.xml has the same effect, because the Play Services plugin adds the values from google-services.json at build-time.
... when only using AdMob, the second option should be preferred.
Do you have inside top-level build.gradle file reference to the google() repo or to maven { url "https://maven.google.com" }? Do you have some specific error inside log?
Try to create a new project and copy old project files and paste in a new one. If it should help!
I am getting following error while building my project while I haven't used firebase auth in my project:
Error: Program type already present: com.google.firebase.auth.FirebaseAuthException
I have tried following but nothing seems to work
Use navigation option
clean rebuild
invalid cache
exclude group module
my dependencies are as:
dependencies {
implementation fileTree( dir: 'libs',include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.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'
implementation ('com.google.firebase:firebase-admin:6.8.0'){
exclude module:'com.google.firebase-auth'
}
}
implementation 'com.google.firebase:firebase-firestore:19.0.1'
You can't use the Firebase Admin SDK in an Android app. It can only be used in a trusted environment, such as your development machine, a server you control, or Cloud Functions.
If you remove this dependency, the error should disappear:
implementation ('com.google.firebase:firebase-admin:6.8.0'){
This problem usually come from a naming conflict (Most probably because a class appears more than once in your project either in the form of dependencies or a mistake).
To find the list of dependencies for the module 'x' we can run
./gradlew x:dependencies to retrieve a list of all the libraries.
From the dependency tree, you an figure out if there is a class/library with the same name being used by two libraries. Based on this finding, you can choose to exclude the module in one of the libraries that are causing the conflict.
I migrated to android studio 3.1
I use an external dependency which uses API 24. I can not do code changes here.
I need to build my app with API 26.
is it possible? how can this be done?
During various trials, I got this error
Gradle: Error: more than one library with the package name
'recyclerview'
app build.gradle
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation project(path: ':libs:externalLib', configuration: 'default')
libs:externalLib build.gradle
dependencies {
compile 'com.android.support:recyclerview-v7:24.0.0-alpha2'
compile 'com.android.support:support-v4:24.0.0-alpha2'
}
Or can I target for API 26 while using 24.x everywhere as a workaround?
You 'must' add you library dependencies in app/build.gradle file.
error says recyclerview library is added twice first you have added it to your gradle and second your library is adding it.
you have to remove implementation 'com.android.support:recyclerview-v7:26.1.0' from your gradle file and contact developer of library to update his library or yourself update it and change its gradle to use version 26 of recyclerview and support library
Recently I have downloaded a code from GitHub and synced it with my android studio. I have faced lots of errors and issues while doing so and somehow fixed most of them. However, the last issue I'm stuck at right now is that my android studio cannot find the class FloatingActionButton as you can see in this screenshot
It is to be noted that earlier many other classes, including 'AppCompatActivity' could not be resolved. Changing the dependencies to following solved the issue
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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'
}
But even after changing dependencies, clean building the project, doing 'Invalidate Caches / Restart...', the problem with 'FloatingActionButton' is still there.
You can check the repository here
And this is the java code of the activity where the error is occurring
The FloatingActionButton is in the design library.
Add this line to your dependencies:
implementation 'com.android.support:design:27.1.1'
This post also has more general info about FloatingActionButton: FloatingActionButton example with Support Library
#Sub 6 Resources already answered this question wholly but I want to add a bonus tip. If you already added implementation 'com.android.support:design:27.1.1' to your code and the compiler can't still resolve the FloatingActionButton class, simply rebuild your project. A colleague and I recently had this same problem while the dependency was already there and a simple rebuild solved it all.
Update for AndroidX:
The answer of #Sub 6 Resources was perfect before androidX was introduced. Now, it is better to include the following dependency instead of the accepted answer's dependency:
implementation 'com.google.android.material:material:1.6.1'
NOTE: it might not be the latest version by the time you are reading this.
I'm using version 2.0.0 of RxJava, and it seems like I have no access to AndroidSchedulers. I'm unable to get access to mainthread through RxJava
AndroidSchedulers class is a part of RxAndroid library. Add it to your app's build.gradle:
before Gradle v3.0:
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
since Gradle v3.0:
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
Go back to Old Versions:
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
Then to the Newer Version:
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.1'
Sounds Weird but it works
I had same problem. You cannot call AndroidSchedulers with RxJava3. I think this is a bug. They need to fix it.
You need to add they on your dependencies of gradle:
//RxAndroid
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
//RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
def rxJavaVersion = '2.1.1'
//Add to dependencies the following libraries
dependencies {
implementation "io.reactivex.rxjava2:rxandroid:$rxJavaVersion"
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
}
Now you can use RX 3 by adding the below dependency
implementation "io.reactivex.rxjava3:rxandroid:$version"
get the version from this link : https://github.com/ReactiveX/RxAndroid