I have the following problem: in android studio I want to load the library 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.1' which I took from here: https://github.com/chthai64/SwipeRevealLayout
But android studio does not give me permission and gives me an error. Who knows how to solve this?
Code gradle:
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.justwork'
compileSdk 32
defaultConfig {
applicationId "com.example.justwork"
minSdk 22
targetSdk 32
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 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.1'
}
I looked at this library in the dialog box and saw that it was impossible to select a version for it. From which I conclude that for some reason android studio does not give me access to this resource.
Related
I tried adding the openweather api and when I try to sync the build.gradle file this error pops up
compileSdkVersion is not specified. Please add it to build.gradle
My File:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.myapplication'
compileSdk 33
defaultConfig {
applicationId "com.example.myapplication"
minSdk 24
targetSdk 33
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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
I already have CompileSDK defined so idk why this still pops up.
This error defines that you haven’t mentioned compileSdkVersion and not compileSdk. Although both means same but still if you are facing this issue mention compileSdkVersion in the build.gradle file.
This issue is relates with the new gradle changes in 7.0.0 so you can use compileSdkVersion with string and with int values like below.
android {
compileSdkVersion = "S"
//or with same number version
}
When i try to sync my project or run a unit test it shows me the following error: Failed to resolve: org.junit.jupiter:junit-jupiter: Affected Modules: app
These are my dependencies:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.catalyst"
minSdkVersion 23
targetSdkVersion 30
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 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.4.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.0.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
androidTestImplementation 'org.junit.jupiter:junit-jupiter'
androidTestImplementation 'org.testng:testng:6.9.6'
}
I have met the same problem. The first comment gives me some tips. But it is not all for the answer.
firstly we should add the junit dependencies.
testImplementation 'junit:junit:{your version}'
then delete the org.junit.jupiter:junit-jupiter dependencies.
for me, it works well.
When I am creating a new project in Android Studio, and load old projects I got this
java.lang.NoClassDefFoundError: org/gradle/internal/impldep/com/google/common/collect/Lists**
**java.lang.ClassNotFoundException: org.gradle.internal.impldep.com.google.common.collect.Lists
ERROR: Unable to load class 'org.gradle.internal.impldep.com.google.common.collect.Lists'
this is my gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 29
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.ncf.fitness"
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'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
You didn't add kotlin version. Try adding kotlin version instead of $kotlin_version.
testImplementation 'junit:junit:4.+'
It also looks like it hasn't complete version name.
Then sync
I had the same problem, I solved it like this.
First go to the Module build.gradle file,
in dependencies change gradle version to 3.2.1
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
Then go to the gradle-wrapper.properties file,
change gradle version back to gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Sync and you're done, problem solved.
I also had to change the versions of the dependencies in the build.gradle of the Project to
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
The end...
I am developing on an app that uses the ActionBarSherlock library project, and the current project uses androidx dependences.
If Make Project will appear
android.support.v4.app not exist error.
error: can't find symbol
symbol: class FragmentActivity
error: package mFragments not exist
and so on...
My question is
1.How to be compatible with the previous android.support package in androidx?
2.How to migrate to androidx correctly which using the old android support library?
My build.gradle in module as follws:
1. build.gradle in Module:ActionBarSherlock which is a lib project of module app
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 4
targetSdkVersion 29
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
build.gradle in app which using the above ActionBarSherlock as lib project
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.app"
minSdkVersion 15
targetSdkVersion 29
multiDexEnabled 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 = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
compile project(':ActionBarSherlock')
configurations.compile.exclude module: 'support-v4'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
implementation 'com.actionbarsherlock:library:4.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
ActionBarSherlock is deprecated. No more development will be taking
place.
As it says in its official repository
So I remind you not to use that library.
"I tried to install my apk but it was giving this message.
Package seems to be corrupted.
this is my build.gradle file". However when I changed my compilesdkversion to 28 it was running. On directly running the app from android studio it is running but after generation apk it is not installing?
apply plugin: 'com.android.application'
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 'android-Q'
defaultConfig {
applicationId "com.example.deskneedui"
minSdkVersion 21
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.wdullaer:materialdatetimepicker:4.2.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.volley:dc-volley:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.wdullaer:materialdatetimepicker:4.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
}
To fully test your app's compatibility with Android Q and begin using new APIs, open your module-level build.gradle file and update the compileSdkVersion and targetSdkVersion as shown below
android {
compileSdkVersion 29
defaultConfig {
targetSdkVersion 29
}
}
FYI
Your classpath will be
classpath 'com.android.tools.build:gradle:3.4.1'
distributionUrl will be
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip