Error:Execution failed for task ':app:compileDebugJavaWithJavac'.>Compilation failed; see the compiler error output for details - android-studio

apply plugin:'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
multiDexEnabled true
applicationId "com.tubbs.citychurchob"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
android.support.test.runner.AndroidJUnitRunner
buildTypes{
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir:'libs', include:['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.firebaseui:firebase-ui:0.4.2'
compile 'com.google.firebase:firebase-database:10.0.1'
}
How to fix this error
Pls ans me.....
I'm using Android studio 2.3.1

Related

Could not find method namespace() for arguments [com.android.mylib] on extension 'android' of type com.android.build.gradle.LibraryExtension

I am trying to create a library in android studio by following this official documentation. But in this particular project, I am facing this issue. if I create new project and create new lib I don't face any issue.
My Lib Gradle
plugins {
id 'com.android.library'
}
android {
namespace 'com.android.mylib'
compileSdkVersion 33
defaultConfig {
minSdkVersion 26
targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
App Gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 33
buildToolsVersion "30.0.2"
testBuildType "beta"
defaultConfig {
applicationId "com.app.etc"
minSdkVersion 23
targetSdkVersion 33
versionCode 327
I have searched some questions, but according to those answers, everything seems correct. i have invalidated cache and restarted the android studio as well.

android studio : minSdkVersion 22 error

I am a complete beginner in android studio and I was having trouble with setting minSdkVersion to 22 for android wear. The problem is caused because of library dependency since it requires the minSdkVersion to be 23 minimum. I looked up in the web and didn't seem to find a solution of how to set the minSdkVersion to 22.
The cod is given below
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "enterprise.supti.myapplication"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.android.support:wearable:2.3.0'
implementation 'com.google.android.gms:play-services-wearable:15.0.1'
implementation 'com.android.support:percent:28.0.0-rc01'
implementation 'com.android.support:support-v4:28.0.0-rc01'
implementation 'com.android.support:recyclerview-v7:28.0.0-rc01'
implementation 'com.android.support:wear:28.0.0-rc01'
compileOnly 'com.google.android.wearable:wearable:2.3.0'
implementation 'com.android.support:support-annotations:28.0.0-rc01'
}

in Android Studio Error “duplicate entry: com/google/android/gms/analytics/internal/Command$1.class”

Here is my gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
compileOptions.encoding = 'ISO-8859-1'
defaultConfig {
multiDexEnabled true
applicationId "com.mujihamzale.Ayat-AyatMerdu"
minSdkVersion 9
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'joda-time:joda-time:2.2'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile files('libs/libGoogleAnalyticsServices.jar')
}
But when running the application on android studio 2.1.3, I get the following error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/analytics/internal/Command$1.class
I have been for days to look for a solution, Please Could you tell me how to solve this problem?

Could not find method ndk() for arguments

I'm following Create Hello-JNI With Android Studio.
MAC OX 10.11.5
Android Studio 2.2 stable
java version: 1.7.0_79
gradle-2.14.1
Here's my app.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.chenql.helloandroidjni"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
ndk {
moduleName "hello-android-jni"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
testCompile 'junit:junit:4.12'
}
Here's the error:
The Error Message
Error:(20, 0) Could not find method ndk() for arguments [build_13jh6qtzl4f08f8c1of3mvsys$_run_closure1$_closure5#5b127949] on project ':app' of type org.gradle.api.Project.
Open File
It turns out that this code
ndk {
moduleName "hello-android-jni"
}
should be placed under "defaultConfig" block:
defaultConfig {
applicationId "com.chenql.helloandroidjni"
minSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
moduleName "hello-android-jni"
}
}
instaed of after "buildTypes" block.
Upgrading to a newer version of the Gradle plugin solves
You just add the following code in android/app/build.gradle
android {
ndkVersion rootProject.ext.ndkVersion //<-- add line
compileSdkVersion rootProject.ext.compileSdkVersion
And in android/build.gradle
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 30
ndkVersion = "22.1.7171670 || {{use your ndk_version}}" //<-- add line
Thats it. Rebuild the app
Comment or delete ndkVersion 'version number' at build.gradle

Error: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/pubnub/api/AbstractLogger.class

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/pubnub/api/AbstractLogger.class
i am facing this error while building the gradle can anyone help me out.????
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "io.atlanticlab.pubnubmaptracker"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.pubnub:pubnub-android-debug:3.7.10'
compile 'com.pubnub:pubnub-android:3.7.10'
}
repositories {
mavenCentral()
}

Resources