Here is app build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.27.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
def versionMajor = 1 //up to 9
def versionMinor = 0 //up to 9
def versionBuild = 12 //up to 999
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.myapp"
minSdkVersion 21
targetSdkVersion 28
versionCode versionMajor * 10_000 + versionMinor * 1_000 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionBuild}"
multiDexEnabled true
}
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "${parent.name}-${variant.versionName}-${variant.versionCode}.apk"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
debug {
storeFile file("keys/debug.jks")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
buildTypes {
debug {
minifyEnabled false
debuggable true
signingConfig signingConfigs.debug
buildConfigField "String", "API_ENDPOINT", "\"https://my.api.endpoint/\""
buildConfigField "String", "GOOGLE_MAP_API_ENDPOINT", "\"https://maps.googleapis.com/maps/api/\""
buildConfigField "String", "GOOGLE_PLACE_API_KEY", "\"some_google_api_key\""
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/mail.jar')
implementation files('libs/activation.jar')
implementation('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true
}
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android:flexbox:0.1.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.yqritc:recyclerview-flexibledivider:1.4.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.11.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
implementation 'me.ydcool.lib:qrmodule:1.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.github.simbiose:Encryption:2.0.0'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'q.rorbin:badgeview:1.1.2'
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.tickaroo.tikxml:retrofit-converter:0.8.16-SNAPSHOT'
implementation 'com.tickaroo.tikxml:annotation:0.8.16-SNAPSHOT'
implementation 'com.tickaroo.tikxml:core:0.8.16-SNAPSHOT'
annotationProcessor 'com.tickaroo.tikxml:processor:0.8.16-SNAPSHOT'
}
apply plugin: 'com.google.gms.google-services'
Here is myApp build.gradle:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
mavenCentral()
maven {
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
maven { url 'https://jitpack.io' }
maven {
url "https://maven.google.com"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is my gradle.properties:
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
android.buildCacheDir=/home/alex/AndroidStudioProjects/myApp_cache
I'm trying to send request via Retrofit2 + RxJava2:
public interface SomeApi {
@POST("SomeService")
Observable<Response<PostAuthResponseEnvelope>> login(@Body PostAuthRequestEnvelope body);
}
@Xml(name="Envelope")
public class PostAuthRequestEnvelope {
@PropertyElement (name = "Body")
private String body;
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
}
Here is logcat:
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: java.lang.RuntimeException: Unable to convert com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope@237b3ad2 to RequestBody
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at retrofit2.ParameterHandler$Body.apply(ParameterHandler.java:357)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at retrofit2.ServiceMethod.toCall(ServiceMethod.java:110)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at retrofit2.OkHttpCall.createRawCall(OkHttpCall.java:184)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at retrofit2.OkHttpCall.execute(OkHttpCall.java:167)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:41)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at io.reactivex.Observable.subscribe(Observable.java:10981)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at java.lang.Thread.run(Thread.java:818)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: Caused by: com.tickaroo.tikxml.TypeAdapterNotFoundException: No TypeAdapter for class com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope found. Expected name of the type adapter is com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope$$TypeAdapter
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at com.tickaroo.tikxml.TypeAdapters.get(TypeAdapters.java:112)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at com.tickaroo.tikxml.TikXmlConfig.getTypeAdapter(TikXmlConfig.java:85)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at com.tickaroo.tikxml.TikXml.write(TikXml.java:128)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at com.tickaroo.tikxml.TikXml.write(TikXml.java:121)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at com.tickaroo.tikxml.retrofit.TikXmlRequestBodyConverter.convert(TikXmlRequestBodyConverter.java:45)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at com.tickaroo.tikxml.retrofit.TikXmlRequestBodyConverter.convert(TikXmlRequestBodyConverter.java:34)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: at retrofit2.ParameterHandler$Body.apply(ParameterHandler.java:355)
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: ... 12 more
01-04 12:17:44.661 22973-22973/com.myapp W/System.err: Caused by: java.lang.ClassNotFoundException: com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope$$TypeAdapter
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at java.lang.Class.classForName(Native Method)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at java.lang.Class.forName(Class.java:308)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at java.lang.Class.forName(Class.java:272)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at com.tickaroo.tikxml.TypeAdapters.get(TypeAdapters.java:88)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: ... 18 more
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope$$TypeAdapter" on path: DexPathList[[zip file "/data/app/com.myapp-2/base.apk", zip file "/data/app/com.myapp-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: ... 22 more
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: Suppressed: java.lang.ClassNotFoundException: com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope$$TypeAdapter
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at java.lang.Class.classForName(Native Method)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: ... 23 more
01-04 12:17:44.671 22973-22973/com.myapp W/System.err: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
01-04 12:17:44.671 22973-22973/com.myapp E/<-- myappApp -->: Unable to convert com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope@237b3ad2 to RequestBody
java.lang.RuntimeException: Unable to convert com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope@237b3ad2 to RequestBody
at retrofit2.ParameterHandler$Body.apply(ParameterHandler.java:357)
at retrofit2.ServiceMethod.toCall(ServiceMethod.java:110)
at retrofit2.OkHttpCall.createRawCall(OkHttpCall.java:184)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:167)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:41)
at io.reactivex.Observable.subscribe(Observable.java:10981)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: com.tickaroo.tikxml.TypeAdapterNotFoundException: No TypeAdapter for class com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope found. Expected name of the type adapter is com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope$$TypeAdapter
at com.tickaroo.tikxml.TypeAdapters.get(TypeAdapters.java:112)
at com.tickaroo.tikxml.TikXmlConfig.getTypeAdapter(TikXmlConfig.java:85)
at com.tickaroo.tikxml.TikXml.write(TikXml.java:128)
at com.tickaroo.tikxml.TikXml.write(TikXml.java:121)
at com.tickaroo.tikxml.retrofit.TikXmlRequestBodyConverter.convert(TikXmlRequestBodyConverter.java:45)
at com.tickaroo.tikxml.retrofit.TikXmlRequestBodyConverter.convert(TikXmlRequestBodyConverter.java:34)
at retrofit2.ParameterHandler$Body.apply(ParameterHandler.java:355)
at retrofit2.ServiceMethod.toCall(ServiceMethod.java:110)
at retrofit2.OkHttpCall.createRawCall(OkHttpCall.java:184)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:167)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:41)
at io.reactivex.Observable.subscribe(Observable.java:10981)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope$$TypeAdapter
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at java.lang.Class.forName(Class.java:272)
at com.tickaroo.tikxml.TypeAdapters.get(TypeAdapters.java:88)
at com.tickaroo.tikxml.TikXmlConfig.getTypeAdapter(TikXmlConfig.java:85)
at com.tickaroo.tikxml.TikXml.write(TikXml.java:128)
at com.tickaroo.tikxml.TikXml.write(TikXml.java:121)
at com.tickaroo.tikxml.retrofit.TikXmlRequestBodyConverter.convert(TikXmlRequestBodyConverter.java:45)
at com.tickaroo.tikxml.retrofit.TikXmlRequestBodyConverter.convert(TikXmlRequestBodyConverter.java:34)
at retrofit2.ParameterHandler$Body.apply(ParameterHandler.java:355)
at retrofit2.ServiceMethod.toCall(ServiceMethod.java:110)
at retrofit2.OkHttpCall.createRawCall(OkHttpCall.java:184)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:167)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:41)
at io.reactivex.Observable.subscribe(Observable.java:10981)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope$$TypeAdapter" on path: DexPathList[[zip file "/data/app/com.myapp-2/base.apk", zip file "/data/app/com.myapp-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.myapp-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at java.lang.Class.forName(Class.java:272)
at com.tickaroo.tikxml.TypeAdapters.get(TypeAdapters.java:88)
at com.tickaroo.tikxml.TikXmlConfig.getTypeAdapter(TikXmlConfig.java:85)
at com.tickaroo.tikxml.TikXml.write(TikXml.java:128)
at com.tickaroo.tikxml.TikXml.write(TikXml.java:121)
at com.tickaroo.tikxml.retrofit.TikXmlRequestBodyConverter.convert(TikXmlRequestBodyConverter.java:45)
at com.tickaroo.tikxml.retrofit.TikXmlRequestBodyConverter.convert(TikXmlRequestBodyConverter.java:34)
at retrofit2.ParameterHandler$Body.apply(ParameterHandler.java:355)
at retrofit2.ServiceMethod.toCall(ServiceMethod.java:110)
at retrofit2.OkHttpCall.createRawCall(OkHttpCall.java:184)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:167)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:41)
at io.reactivex.Observable.subscribe(Observable.java:10981)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Suppressed: java.lang.ClassNotFoundException: com.myapp.data.net.rest.request.post_auth_request.PostAuthRequestEnvelope$$TypeAdapter
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 23 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I have been trying to figure out what is going wrong for a couple days, but still no result=((