I have mentioned my gradle below please let me know what is the solution for that question and have used the api level 25 in my project
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
signingConfigs {
config {
keyAlias 'yaksha'
keyPassword '123456'
storeFile file('/home/abhinav/Downloads/yaksha.jks')
storePassword '123456'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.tene.yaksha"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
testApplicationId "com.tene.yaksha1"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
testHandleProfiling true
testFunctionalTest true
}
testOptions {
reportDir "$rootDir/test-reports"
resultsDir "$rootDir/test-results"
}
dataBinding {
enabled = true
}
dexOptions {
//incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g"
}
lintOptions {
// lintConfig file("$project.rootDir/tools/rules-lint.xml")
abortOnError false
htmlOutput file("$project.buildDir/outputs/lint/lint.html")
warningsAsErrors false
xmlReport true
}
buildTypes {
release {
minifyEnabled true
debuggable false
jniDebuggable true
signingConfig signingConfigs.config
renderscriptDebuggable true
shrinkResources true
proguardFile '/home/abhinav/Android/Sdk/tools/proguard/yakshaproguard.txt'
}
debug {
minifyEnabled false
proguardFile '/home/abhinav/Android/Sdk/tools/proguard/yakshaproguard.txt'
multiDexKeepFile file('multidex-config.txt')
}
}
packagingOptions
{
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
testOptions {
unitTests.returnDefaultValues = true
unitTests {
all {
jvmArgs '-XX:MaxPermSize=256m'
if (it.name == 'testDebug') {
systemProperty 'debug', 'true'
}
if (it.name == 'connectedDebugAndroidTest') {
}
}
}
}
configurations {
}
}
dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services:10.2.1'
compile project(':realmtenedbservice')
compile project(':tenewsrestlib')
compile project(':TeneLocationLib')
compile project(':SecurityYsc')
compile project(':library')
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.birbit:android-priority-jobqueue:2.0.1'
compile 'com.fasterxml.jackson.core:jackson-core:2.7.3'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'
compile 'io.reactivex:rxjava:1.1.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.google.maps.android:android-maps-utils:0.4+'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'io.realm:android-adapters:1.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.sromku:simple-storage:1.2.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'joda-time:joda-time:2.9.7'
compile 'id.zelory:compressor:1.0.4'
compile 'io.reactivex:rxandroid:1.2.1'
}
I'm getting this error while running the project,can you anybody give suggesions why this is coming
Information:Gradle tasks [:app:assembleDebug]
Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/commons/io/CopyUtils.class
Information:BUILD FAILED
Information:Total time: 18.768 secs
Information:1 error
Information:1 warning
Information:See complete output in console
You can exclude that class, which is showing duplicate like as
configurations {
all*.exclude group: 'org.apache.commons'
}
I thik this is duplicate
compile 'com.android.support:multidex:1.0.1'
Related
This is thrown when trying to open activity using context.startActivity(intent)
java.lang.TypeNotPresentException: Type android/support/v4/app/ActivityCompat$SharedElementCallback23Impl not present
All activities extends AppCompatActivity and I am calling AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) inside a static block of my application.
On newer android versions everyting is ok.
Does anybody met this issue and can share info how to solve it?
Here my gradle configuration
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
lintOptions {
disable 'RestrictedApi'
}
signingConfigs {
release {
keyAlias '****'
keyPassword '*************'
storeFile file('../release.jks')
storePassword '*************'
}
}
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "***.****"
minSdkVersion 19
targetSdkVersion 26
versionCode 8
versionName "1.0.3"
vectorDrawables.useSupportLibrary true
multiDexEnabled true
renderscriptTargetApi 26
renderscriptSupportModeEnabled true
signingConfig signingConfigs.release
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
jcenter()
}
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':googleemoji')
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude module: 'httpclient'
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.http-client:google-http-client-gson:1.22.0') {
exclude module: 'httpclient'
}
compile('com.google.apis:google-api-services-gmail:v1-rev44-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile 'com.google.firebase:firebase-auth:11.4.0'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:customtabs:26.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.google.android.gms:play-services-identity:11.4.0'
compile 'com.google.firebase:firebase-messaging:11.4.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.google.android.gms:play-services-auth:11.4.0'
compile 'com.google.android.gms:play-services-plus:11.4.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'commons-io:commons-io:2.5'
compile 'com.google.android.gms:play-services-location:11.4.0'
compile 'com.google.firebase:firebase-invites:11.4.0'
}
kotlin {
experimental {
coroutines "enable"
}
}
apply plugin: 'com.google.gms.google-services'
I have generated my signed apk for product flavors, but when i try to install the apk in my device, it says "App not installed"
Here is my gradle file code :-
android {
compileSdkVersion 25
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.app.olivesync"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors{
main {
applicationId "com.app.olivesync"
}
resonance {
applicationId "com.app.resonance"
}
}
dependencies {
compile('com.fasterxml.jackson.core:jackson-annotations:2.2.2') {
exclude group: 'com.fasterxml.jackson.core'
}
compile('com.fasterxml.jackson.core:jackson-databind:2.2.3') {
exclude group: 'com.fasterxml.jackson.core'
}
compile('com.fasterxml.jackson.core:jackson-core:2.2.3') {
exclude group: 'com.fasterxml.jackson.core'
}
compile 'com.android.support:support-v4:25.3.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.roomorama:caldroid:3.0.1'
compile 'com.android.support:design:25.3.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4#aar'
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1#aar'
compile 'com.google.firebase:firebase-crash:10.2.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.github.iammert:MaterialIntroView:1.6.0'}
repositories {
maven { url "https://jitpack.io" }
}
apply plugin: 'com.google.gms.google-services'
change your version and then try to build sign apk. Hope it will work.
Very often while compiling I get the following error:
Error:(5, 18) error: cannot find symbol class DaggerDataComponent
Error:(14, 21) error: cannot find symbol class DaggerNetComponent
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
It is enough to start building again with no changes to make the building succeeding.
I have the Instant Run feature disabled.
I'm using Java8 with retrolambda and dagger2 2.8.
This is my build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.3.1'
}
}
plugins {
id "me.tatarka.retrolambda" version "3.3.1"
}
// Required because retrolambda is on maven central
repositories {
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 25
buildToolsVersion "24.0.2"
compileOptions.incremental = false
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "org.app"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
jackOptions {
enabled false
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
compileOptions {
incremental true
}
/**
* Signing keys config.
*/
signingConfigs {
debug {
storeFile file("ddebug.keystore")
keyAlias "ddebug"
storePassword "07477800086d!"
keyPassword "07477800086d!"
}
release {
storeFile file("drelease.keystore")
keyAlias "drelease"
storePassword "07477800086d!"
keyPassword "07477800086d!"
}
}
buildTypes {
release {
debuggable false
minifyEnabled true
zipAlignEnabled true
renderscriptDebuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
signingConfig signingConfigs.debug
minifyEnabled false
versionNameSuffix "_dev"
}
}
}
dependencies {
apt 'com.google.dagger:dagger-compiler:2.7'
compile 'com.google.dagger:dagger:2.7'
provided 'javax.annotation:jsr250-api:1.0'
apt 'com.gabrielittner.auto.value:auto-value-with:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
def supportVersion = '25.1.0'
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:design:$supportVersion"
compile "com.android.support:cardview-v7:$supportVersion"
compile "com.android.support:recyclerview-v7:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
compile "com.android.support:gridlayout-v7:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
compile 'io.reactivex:rxandroid:0.24.0'
def retrofit2 = '2.1.0'
def okhttp3 = '3.4.1'
compile "com.squareup.retrofit2:retrofit:$retrofit2"
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit2"
compile "com.squareup.retrofit2:converter-gson:$retrofit2"
compile "com.squareup.okhttp3:okhttp:$okhttp3"
compile "com.squareup.okhttp3:okhttp-urlconnection:$okhttp3"
compile "com.squareup.okhttp3:logging-interceptor:$okhttp3"
def butter_knife = '8.4.0'
apt "com.jakewharton:butterknife-compiler:$butter_knife"
compile "com.jakewharton:butterknife:$butter_knife"
def leak_canary = '1.4-beta2'
debugCompile "com.squareup.leakcanary:leakcanary-android:$leak_canary"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_canary"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_canary"
compile 'com.github.clans:fab:1.6.4'
compile 'io.reactivex:rxjava:1.2.0'
compile 'io.reactivex:rxandroid:1.2.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
provided 'com.google.auto.value:auto-value:1.2'
apt 'com.google.auto.value:auto-value:1.2'
compile 'com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.5'
apt 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
apt 'com.ryanharter.auto.value:auto-value-gson:0.3.2-rc1'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.jakewharton.timber:timber:4.3.1'
compile 'com.google.firebase:firebase-crash:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'junit:junit:4.12'
//other dependencies for testing
def hamcrestVersion = '1.3'
testCompile "org.hamcrest:hamcrest-core:$hamcrestVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
testCompile "org.hamcrest:hamcrest-integration:$hamcrestVersion"
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
apply plugin: 'com.google.gms.google-services'
android.packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
I am trying to setup a framework in Android Studio with Espresso and Cucumber.
When I am trying to run Android test configuration, the build fails giving me the following exception:
Execution failed for task ':app:preDexDebugAndroidTest'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
This is my bundle.gradle file dependencies.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "testapp.drayson.com.testapp"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
// multiDexEnabled true
testInstrumentationRunner "testapp.drayson.com.testapp.Instrumentation"
}
sourceSets {
androidTest {
assets.srcDirs = ['src/androidTest/assets']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'com.android.support:support-annotations:23.1.0'
androidTestCompile('com.android.support.test:runner:0.3')
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
//Cucumber
androidTestCompile 'info.cukes:cucumber-android:1.2.0#jar'
androidTestCompile 'info.cukes:cucumber-picocontainer:1.2.4'
androidTestCompile('info.cukes:cucumber-junit:1.1.4') {
exclude module: 'cucumber-jvm-deps'
exclude module: 'cucumber-core'
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
androidTestCompile('info.cukes:cucumber-jvm:1.2.4') {
}
androidTestCompile('info.cukes:cucumber-core:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile('info.cukes:cucumber-jvm-deps:1.0.3') {
}
//Espresso
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.1') {
exclude module: 'junit'
exclude module: 'runner'
}
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
exclude module: 'espresso-core'
exclude module: 'support-v4'
}
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
try adding multiDexEnabled as true in your
buildType{ release{ multiDexEnabled true} }
hope it works for you..
I am trying to get all the libraries for docx4j obtained here:
https://stackoverflow.com/a/23710079/1616685
I set up MultiDex successfully, however I get a duplicated entry error:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: org/apache/harmony/awt/internal/nls/Messages.class
as you can see there are a lot of libraries to compile... it is easy to have duplicates, is there a way to avoid from the gradle such errors?
here the gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.example.test_images"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
}
dexOptions {
preDexLibraries = false
// incremental true
javaMaxHeapSize "4g"
incremental true
}
productFlavors {
}
compileOptions {
}
}
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = false
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = false
}
}
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
dependencies {
compile ('com.android.support:multidex:1.0.0'){ exclude group: 'java.util.zip' }
compile ('com.android.support:appcompat-v7:22.2.0')
compile ('com.parse.bolts:bolts-android:1.+')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/ae-awt.jar')
compile files('libs/ae-docx4j-2.8.0-SNAPSHOT.jar')
compile files('libs/ae-jaxb-2.2.5.jar')
compile files('libs/ae-xmlgraphics-commons.jar')
compile files('libs/avalon-framework-api-4.3.1.jar')
compile files('libs/avalon-framework-impl-4.3.1.jar')
compile files('libs/commons-codec-1.3.jar')
compile files('libs/commons-io-1.3.1.jar')
compile files('libs/commons-lang-2.4.jar')
compile files('libs/commons-logging-1.1.1.jar')
compile files('libs/droidText.0.4.jar')
compile files('libs/istack-commons-runtime.jar')
compile files('libs/JAXBNamespacePrefixMapper-2.2.4.jar')
compile files('libs/jaxp-datatype.jar')
compile files('libs/log4j-1.2.15.jar')
compile files('libs/serializer-2.7.1.jar')
compile files('libs/stringtemplate-3.2.1.jar')
compile files('libs/txw2-20110809.jar')
compile files('libs/w3c-css.jar')
// compile 'com.android.support:support-annotations:22.2.0'
// compile 'com.android.support:multidex:1.0.0'
}
https://github.com/plutext/Docx4j4Android4/ is an Android Studio project; it uses Maven shade plugin to repackage org.apache.http