我有一个使用sdk 22版编译的应用程序,实际上我需要将其升级到23以添加新的元素和功能。
问题:在升级它并解决依赖性问题之后(不推荐使用httpclient,所以我使用了doc中提到的useLibrary'org.apache.http.legacy')我在app启动后就出现了这个错误:
03-14 18:10:53.788 1566-2303/? E/AndroidRuntime: FATAL EXCEPTION: Thread-12338
Process: com.my.app.debug, PID: 1566
java.lang.InternalError: Thread starting during runtime shutdown
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:1063)
at org.apache.http.impl.conn.tsccm.AbstractConnPool.enableConnectionGC(AbstractConnPool.java:145)
at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.createConnectionPool(ThreadSafeClientConnManager.java:125)
at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.<init>(ThreadSafeClientConnManager.java:103)
at org.acra.util.HttpRequest.getHttpClient(HttpRequest.java:214)
at org.acra.util.HttpRequest.send(HttpRequest.java:141)
at org.acra.sender.HttpSender.send(HttpSender.java:225)
at org.acra.SendWorker.sendCrashReport(SendWorker.java:179)
at org.acra.SendWorker.checkAndSendReports(SendWorker.java:141)
at org.acra.SendWorker.run(SendWorker.java:77)
我已经读过这个问题是ACRA中报告的错误,但最新版本已经解决了。如何使用“uselibrary”而不是在使用sdkversion 22时遇到此问题?
这是迁移前的build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.github.ben-manes.versions'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
}
}
dependencies {
compile files('libs/pixlui-1-0-5.jar')
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.google.android.gms:play-services-base:8.1.0'
compile 'com.androidmapsextensions:android-maps-extensions:2.2.0'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.android.support:support-v4:22.2.0'
compile ('ch.acra:acra:4.5.0'){
exclude group: 'org.json'
}
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
compile 'com.squareup.picasso:picasso:2.3.4'
provided 'com.squareup.dagger:dagger-compiler:1.2.0'
compile 'com.squareup.dagger:dagger:1.2.0'
compile 'com.google.guava:guava:15.0'
compile 'com.mixpanel.android:mixpanel-android:4.5.3'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.github.rahatarmanahmed:circularprogressview:2.3.2'
compile 'com.android.support:design:22.2.0'
compile 'com.github.hotchemi:android-rate:0.5.6'
// Testing dependencies
testCompile "junit:junit:4.5"
testCompile "org.mockito:mockito-core:1.9.5"
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2'){
exclude module: 'support-annotations'
}
androidTestCompile 'com.android.support.test:rules:0.2'
}
这是在迁移build.gradle之后:
apply plugin: 'com.android.application'
apply plugin: 'com.github.ben-manes.versions'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
}
}
dependencies {
compile files('libs/pixlui-1-0-5.jar')
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.androidmapsextensions:android-maps-extensions:2.2.0'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.android.support:support-v4:23.2.0'
compile ('ch.acra:acra:4.5.0'){
exclude group: 'org.json'
}
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
compile 'com.squareup.picasso:picasso:2.3.4'
provided 'com.squareup.dagger:dagger-compiler:1.2.0'
compile 'com.squareup.dagger:dagger:1.2.0'
compile 'com.google.guava:guava:15.0'
compile 'com.mixpanel.android:mixpanel-android:4.5.3'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.github.rahatarmanahmed:circularprogressview:2.3.2'
compile 'com.android.support:design:23.2.0'
compile 'com.github.hotchemi:android-rate:0.5.6'
testCompile "junit:junit:4.5"
testCompile "org.mockito:mockito-core:1.9.5"
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2'){
exclude module: 'support-annotations'
}
androidTestCompile 'com.android.support.test:rules:0.2'
}
android {
useLibrary 'org.apache.http.legacy'
signingConfigs {
blabla...
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
exclude 'LICENSE.txt'
}
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId 'com.my.app'
minSdkVersion 14
targetSdkVersion 23
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
def STRING = "String"
def TRUE = "true"
def FALSE = "false"
def URL_REQUEST = "URL_REQUEST"
debug {
blabla
}
release {
blabla
}
}
productFlavors {
full {
blabla
}
}
}
我是Android新手,我做错了什么?