Android studio : No variants found - android

enter image description here
Hi I'm learning Android studio new and I bought the source from CodeCanyon and solved some errors, but I got stuck in this error:
No variants found for ':app'. Check build files to ensure at least one variant exists.
I checked cdk tools and everything seems fine and I also searched for answers and tried them but I couldn't solve this error.
here is my code :
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId 'com.quraan.farroukh'
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
ndk {
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}
}
lintOptions {
checkReleaseBuilds false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
}
}
dependencies{
task wrapper(type: Wrapper){
gradleVersion = '2.14.1'
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.browser:browser:1.3.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.google.android.gms:play-services-ads:20.2.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.google.android.gms:play-services-analytics-impl:17.0.0'
implementation 'com.github.varunest:sparkbutton:1.0.6'
implementation 'com.airbnb.android:lottie:3.6.1'
implementation 'com.github.glomadrian:Grav:1.1'
implementation 'hanks.xyz:htextview-library:0.1.5'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'io.saeid:fab-loading:1.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'de.hdodenhof:circleimageview:3.1.0'
}

I guess, you probably didn't install SDK 29.
Go to File->Settings->Appearance and Behaviour->System Settings->Android SDK
Check the specific version of API Level and install it if it's missing

Related

I was just building the app using source code and found these issues

How can I solve this issue? I tried searching in YouTube and Chrome couldn't find the relevant solution for this. There are three issues faced. I tried changing various things in settings and tried different solution but none of those helped
THIS IS BUILD.GRADLE (app):
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion '29.0.1'
defaultConfig {
applicationId "com.pdf.scanner.queenscanner"
minSdkVersion 16
targetSdkVersion 31
versionCode 1
versionName '1.1'
multiDexEnabled true
//Photo editor
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
//Photo editor
dataBinding {
enabled = 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
}
}
repositories {
maven { url "http://jitpack.io" }
//tedpicker
maven { url "http://repo.commonsware.com.s3.amazonaws.com" }
maven { url "http://s3.amazonaws.com/repo.commonsware.com" }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
//Add library
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//hungdh
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation project(':openCVLibrary310')
//Photo editor
// annotationProcessor 'ly.img.android:photo-editor-sdk:2.0.27'
// compile 'ly.img.android:photo-editor-sdk:2.0.27'
//OCR
implementation 'com.rmtheis:tess-two:6.1.1'
implementation 'com.github.mthli:Knife:v1.1'
//Opennote
implementation 'com.google.zxing:core:3.3.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//compile 'com.github.ctodobom:OpenCV-3.1.0-Android:9e00ee4218ca0c9e60a905c9f09bf499f9dc5115'
implementation 'us.feras.mdv:markdownview:1.1.0'
implementation 'com.github.ctodobom:drag-select-recyclerview:0.3.4.ctodobom.sections'
implementation 'com.github.nostra13:Android-Universal-Image-Loader:v1.9.5'
implementation 'com.github.ctodobom:FabToolbar:3c5f0e0ff1b6d5089e20b7da7157a604075ae943'
//Simple document scanner
implementation 'com.afollestad.material-dialogs:core:0.8.5.9'
implementation 'com.jakewharton.timber:timber:4.1.2'
//ImagetoPDF
implementation project(':tedpicker')
implementation project(':photo-editor-sdk-2.0.27')
implementation 'com.itextpdf:itextg:5.5.9'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.jakewharton:butterknife:10.2.1'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
implementation 'androidx.multidex:multidex:2.0.1'
//Auto mail
implementation 'com.github.yesidlazaro:GmailBackground:1.2.0'
implementation 'com.github.nextcloud:android-library:-SNAPSHOT'
//filter_image
implementation 'it.chengdazhi.styleimageview:styleimageview:1.0.4'
//photoview
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.google.android.gms:play-services-ads:21.3.0'
//sửa là lỗi (lúc có firebase-core)
//implementation files('/libs/photo-editor-sdk-2.0.14.aar')
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.facebook.android:facebook-android-sdk:5.13.0'
implementation 'com.facebook.android:audience-network-sdk:5.8.0'
implementation project(path: ':dynamicgrid')
}
You could download the corresponding JAR file directly from the package's Maven repository site and put it into the libs directory of your project. This earlier Stackoverflow thread might be helpful in the details.

How to change the "min Sdk version"?

I'm changing the minSdk version but when I build/generate apk(s) I get this error:
failed linking references.
I have tried Invalidating Caches and restarting
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.clubs"
minSdkVersion 21
targetSdkVersion 27
vectorDrawables.useSupportLibrary = true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'nl.psdcompany:duo-navigation-drawer:3.0.0'
implementation 'com.github.ApendIr:slider:1.0'
implementation 'com.azoft.carousellayoutmanager:carousel:1.2.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
I don't know if this is what is resulting to the apps crashing in some phones
Set the min SDK version within your project's AndroidManifest.xml file:
<uses-sdk android:minSdkVersion="21"/>

How to solve unresolved superstypes

I am new to kotlin and I didn't manage to find a direct solution to this issue. I added a fragment class and layout to my project and it started showing this issue during execution.
The error states,
"Supertypes of the following classes cannot be resolved. Please make sure you have the right dependencies in the classpath: class androidx.app.appcompat.app.AppCompatActivty, unresolved supertypes: androidx.core.app.TaskStackBuilder.SupportParentable".
I have attached my gradle file contents.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 28
defaultConfig {
applicationId "mapp.com.sg.mappfinalassignment"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.+'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'com.google.android.material:material:1.0.0-beta01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'com.android.support:recyclerview-v7:28.+'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-fragment:28.0.0'
implementation 'com.google.android:support-v4:r7'
}
repositories {
jcenter()
mavenCentral()
}
How do I get it to run?
You cannot use new AndroidX dependencies with the old ones. You can try to run Refactor > Migrate to AndroidX in your Android studio or convert you dependencies manually. Here is the documentation which will help you.

Error: Program type already present: com.facebook.ads.Ad

I am trying to implement facebook sdk according to this,
https://developers.facebook.com/docs/audience-network/android
When I trying to compile it im getting this error.
Error: Program type already present: com.facebook.ads.Ad
I'm using android studio 3.2.1
this is my gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.test.test"
minSdkVersion 16
targetSdkVersion 27
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
implementation 'com.google.android.gms:play-services:+'
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-ads:11.6.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.facebook.android:facebook-core:[4,5)'
implementation 'com.facebook.android:facebook-marketing:[4,5)'
implementation 'com.android.support:recyclerview-v7:25.3.1' // Required Dependency by Audience Network SDK
implementation 'com.facebook.android:audience-network-sdk:5.+'
// More deps here //
}

Getting "Program type already present" Error When Building Signed APK

I added FFmpeg extension to my ExoPlayer implementation and started getting
the following error when trying to generate a signed APK:
Error: Program type already present: com.google.android.exoplayer2.analytics.AnalyticsCollector$Factory
I can generate a debug APK without problems. I tried to see the dependencies using ./gradlew app:dependencies, however I cannot see what's wrong and which configuration to examine.
I don't see where and which ExoPlayer library is added as duplicate.
Here is my build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.acompany.anandroitvapp"
minSdkVersion 26
targetSdkVersion 27
versionCode 18
versionName "0.9.18_"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:leanback-v17:27.1.1'
implementation 'com.android.support:preference-leanback-v17:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-tv-provider:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
// Injections
//compile 'com.google.dagger:dagger:2.12'
//annotationProcessor 'com.google.dagger:dagger-compiler:2.12'
//Retrofit Dependencies
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.exoplayer:exoplayer:2.8.3'
implementation 'com.google.android.exoplayer:extension-leanback:2.6.1'
implementation project(':exoplayer-extension-ffmpeg')
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.google.firebase:firebase-perf:16.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
/* optional: for detailed logging */
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'io.reactivex.rxjava2:rxjava:2.1.14'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
}
apply plugin: 'com.google.gms.google-services'

Categories

Resources