Android app:transformClassesWithJarMergingForDebugAndroidTest - android

I try to launch automatic test
#RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
#Rule public final ActivityTestRule<OrderManagementActivity> main = new ActivityTestRule<OrderManagementActivity>(OrderManagementActivity.class);
#Test
public void shouldBeAbleToLaunchMainScreen(){
onView(withId(R.id.but_continue)).check(ViewAssertions.matches(isDisplayed()));
}
}
and I'm getting this execution failed for task.
Error:Execution failed for task':app:transformClassesWithJarMergingForDebugAndroidTest'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/junit/ClassRule.class
This is my gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "xx.zakupy"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
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.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.google.dagger:dagger:2.8'
apt 'com.google.dagger:dagger-compiler:2.8'
compile 'joda-time:joda-time:2.9.7'
compile "org.parceler:parceler-api:1.1.6"
apt "org.parceler:parceler:1.1.6"
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
}

Related

Android apps crash when excute "startservice()" on sdk 25 and lower

In my apps i used a service class for sync data from my server. It's working fine before for all type device. Now it's work only for 26+ SDK device, and crushed on 25 and lower SDK. It's crushed when execute startService(intent). And can't get any exception in try catch .
Here is my activity code :
try {
if(!isMyServiceRunning(SyncdataService.class)){
Intent intent = new Intent(this, SyncdataService.class);
stopService(intent);
startService(intent);
}
}catch (Exception e){
Log.d("Exception", "Error: " + e.toString());
}
And This is my Gradel :
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.catalystconnect.catalystconnect"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
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:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:support-vector-drawable:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26.+'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.+'
compile 'me.leolin:ShortcutBadger:1.1.8'
compile 'com.google.firebase:firebase-core:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.twilio:voice-android:2.0.4'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.koushikdutta.ion:ion:2.1.8'
compile 'com.google.firebase:firebase-messaging:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
Why this happen ?

Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve project :learncodings

Am adding learncoding project to my project us module dependency but it shows this error.
Any one please help me. below gradle is my app's gradle
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
aaptOptions {
cruncherEnabled = false
}
defaultConfig {
applicationId "com.droidacademy.codings"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/', 'src/main/assets/c_outputs']
res.srcDirs = ['src/main/res', 'src/main/res/anim', 'src/main/res/layout-sw600dp']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
mavenCentral()
jcenter()
}
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile files('libs/volley.jar')
compile files('libs/achartengine-1.0.0.jar')
compile files('libs/gson-1.7.jar')
compile 'com.github.florent37:materialtextfield:1.0.5'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.felipecsl.asymmetricgridview:library:2.0.1'
compile files('libs/mail.jar')
compile 'com.github.PhilJay:MPAndroidChart:v2.2.4'
compile 'com.intuit.sdp:sdp-android:1.0.4'
compile 'com.squareup.picasso:picasso:2.5.2'
implementation project(':learncodings')
}
and this is my module app's Gradle
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
aaptOptions {
cruncherEnabled = false
}
defaultConfig {
applicationId "com.whalts.learncoding"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services-gcm:9.2.0'
compile 'com.google.android.gms:play-services-ads:9.2.0'
}
Go to File\Settings\Gradle. Deselect the "Offline work" box.
If this didn't work Try to Invalidate Cache/Restart

Gradle Sync Failed..could not find method lintOptions() for argument Could not get unknown property 'compile' for object

this is my build.gradle file please help me out ..
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.androidhive.info.weplanbeta"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
these are the dependencies i think i have organized them properly but still its not running
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.mikepenz:materialdrawer:5.3.1#aar') {
transitive = true
}
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:9.0.2'
compile 'com.ncapdevi:frag-nav:1.0.3'
compile 'com.roughike:bottom-bar:1.3.9'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
You should enable lintOptions
android {
...
lintOptions {
checkReleaseBuilds false
abortOnError false
ignoreWarnings true //false
}
}
And
implementation 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:design:25.1.0'
implementation 'com.android.support:support-v4:25.1.0'
implementation 'com.android.support:recyclerview-v7:25.1.0'

java.lang.ClassNotFoundException: Didn't find class from AAR

I have a android library project from which i created AAR file. I have added that AAR file into my application project, while running i get the following exception:
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.creatrixone.customcomponents.LoadMoreListView" on path:
DexPathList[[zip file "/data/app/com.creatrixcampus-1.apk"],
nativeLibraryDirectories=[/data/app-lib/com.creatrixcampus-1, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.view.LayoutInflater.createView(LayoutInflater.java:559)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
I updated both Library and Application project gradle file after visiting below link,
Android Library AAR depending on another library
but no use,
this is my updated library build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
version '1.1.1'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.0'
compile 'com.koushikdutta.ion:ion:2.1.7'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
//session handelling using JWT
compile 'io.jsonwebtoken:jjwt:0.6.0'
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0#aar'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
//applicationId "com.creatrixone"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.1.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
productFlavors {
}
dexOptions {
incremental true
}
}
this is my updated project build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
maven { url "${System.env.HOME}/.m2/repository" }
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId 'com.creatrixcampus'
minSdkVersion 15
targetSdkVersion 23
versionCode 20160504
versionName "1.5.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
compile project(':photoViewerLibrary')
compile project(':multipleImagePick')
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile ':creatrixone1_1#aar'
compile 'com.google.code.gson:gson:2.4'
compile 'com.github.alamkanak:android-week-view:1.2.1'
compile 'com.google.zxing.client.android:barcode_1.0:1.1.0#aar'
compile 'com.google.zxing:android-integration:3.2.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'xyz.danoz:recyclerviewfastscroller:0.1.3'
//session handelling using JWT
compile 'io.jsonwebtoken:jjwt:0.6.0'
compile 'com.koushikdutta.ion:ion:2.1.7'
}

Cannot resolve com.amazonaws:aws-android-sdk-lambda:2.2.+

I am developing android app backend with amazon cognito and lambda.
My Code:
package digits.digitsapp;
import com.amazonaws.mobileconnectors.lambdainvoker.LambdaFunction;
public interface MyInterface {
#LambdaFunction
String digitsLogin(PhoneInfo phoneInfo);
#LambdaFunction(functionName = "digitsLogin")
void noDigitsLogin(PhoneInfo phoneInfo);
}
app(build.gradle) :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.testing"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'com.amazonaws:aws-android-sdk-lambda:2.2.+'
}
My problem is Error:(39, 13) Failed to resolve: com.amazonaws:aws-android-sdk-lambda:2.2.+
when i add lambda sdk then i sync gradle then error comes.
please tell me what to do

Categories

Resources