Closed 643063150 closed 1 year ago
RxHttp版本多少?用什么方式依赖的? RxHttp未生成问题,看看常见问题列表
1.版本为 def rxhttp_version = '3.0.2' 2.gradle java方式依赖 3.没有引入ObjectBox前一切正常,已经写了大量的网络访问业务 考虑需要数据库后引入ObjectBox 开始无法生成rxhttp 删除ObjectBox相关依赖 又恢复正常 4.搜索了issue暂未看到跟我一样的问题的人
app gradle文件
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.zpp.mobile.zmusic"
minSdk 23
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
configurations.all {
resolutionStrategy { force 'androidx.recyclerview:recyclerview:1.2.0','org.jetbrains.kotlin:kotlin-stdlib:1.7.10','org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10' }
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [
//使用asXxx方法时必须,传入你依赖的RxJava版本
rxhttp_rxjava: '3.1.6',
]
}
}
}
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'
}
buildFeatures{
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
def rxhttp_version = '3.0.2'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
implementation 'com.github.Ye-Miao:StatusBarUtil:1.7.5'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation "io.github.cymchad:BaseRecyclerViewAdapterHelper:4.0.0-beta02"
implementation 'com.github.centerzx:ShapeBlurView:1.0.5'
implementation 'com.yqritc:recyclerview-flexibledivider:1.4.0'
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation "com.github.liujingxing.rxhttp:rxhttp:$rxhttp_version"
annotationProcessor "com.github.liujingxing.rxhttp:rxhttp-compiler:$rxhttp_version"
//RxJava3
implementation 'io.reactivex.rxjava3:rxjava:3.1.6'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
implementation 'com.github.liujingxing.rxlife:rxlife-rxjava3:2.2.2' //管理RxJava3生命周期,页面销毁,关闭请求
implementation 'com.github.xiaohaibin:XBanner:androidx_v1.2.6'
// implementation 'com.github.jrfeng.snow:player:1.2.5'
implementation 'com.github.643063150.snow:player:v1.0.0'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'com.android.support:palette-v7:28.0.0'
implementation 'com.tencent:mmkv-static:1.2.12'
implementation "com.google.guava:guava:29.0-android"
implementation 'com.lzp:FlycoTabLayoutZ:1.3.3'
implementation 'com.github.jrfeng:rv-helper:1.2.2'
//加入这行往下这些就会报错 不加一切正常
// implementation 'com.google.android.exoplayer:exoplayer:2.17.0'
// debugImplementation "io.objectbox:objectbox-android-objectbrowser:3.5.1"
// releaseImplementation "io.objectbox:objectbox-android:3.5.1"
}
//apply plugin: 'io.objectbox'
项目的gradle文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0'
// classpath("io.objectbox:objectbox-gradle-plugin:3.5.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
如果集成了kotlin,则需要使用ksp
或kapt
依赖rxhttp-compiler
,rxhttp_rxjava
参数传递也同步更改,改完再试试
如果集结了kotlin,则需要使用
ksp
或者kapt
依赖rxhttp-compiler
,rxhttp_rxjava
参数传递也同步修改,修改完成再试
啰嗦一句,项目为了兼容某些库仅仅集成了kt但没有使用,也需要用ksp方式吗,转为ksp后请求对现有java写的业务有影响吗,谢谢
没影响
没影响
使用kspt方式引入后,可以正常生成,不过环境不同,出问题的是Android studio得老版本 验证用的家里的电脑是最新版本的 先记一下 感谢回答
集成此库后,rebulid是可以正常生成rxhttp的类的,再集成ObjectBox后无法正常生成rxhttp类,即使已经生成了,ObjectBox添加表后rebulid还是会报错显示无rxhttp