我得到一个非常奇怪的错误。我可以从android studio运行我的应用程序,我可以使用android-debug-unaligned.apk在runnung gradle build之后加载应用程序,但是当我尝试加载release.apk或android-release-unaligned.apk时,它会失败关于第一项活动。 build.gradle在下面。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
repositories {
mavenCentral()
maven {
url 'http://maven.mysite.com/artifactory/libs-snapshot-local'
credentials {
username = 'username'
password = 'password'
}
}
}
apply plugin: 'android'
dependencies {
compile(group: 'com.mysite', name: 'lib', version: '2.4', ext: 'aar')
}
android {
compileSdkVersion 19
buildToolsVersion '19.0.0'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
assets.srcDirs = ['assets']
res.srcDirs = ['res']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
def password = null
def keystore_path = null
def console = System.console()
if (console != null) {
keystore_path = console.readLine("Enter keystore path: ")
password = console.readLine("Enter keystore password: ")
signingConfigs {
release {
storeFile file(keystore_path)
storePassword (password)
keyAlias "maithuandroidkey"
keyPassword (password)
}
}
buildTypes {
release {
runProguard true
proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
proguardFile 'proguard-project.txt'
signingConfig signingConfigs.release
}
}
}
}
}
我注意到log cat中有两个错误。第一个,我认为可能是错误,但我不明白为什么它在调试模式下工作...
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
at java.util.concurrent.FutureTask.run(FutureTask.java:239)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.ClassCastException: com.google.b.b.x cannot be cast to com.mysite.e.g
at com.mysite.MedicApplication.u(Unknown Source)
at com.mysite.MedicApplication.t(Unknown Source)
at com.mysite.c.doInBackground(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)at java.lang.Thread.run(Thread.java:841)
这一个弹出调试apk但似乎没有破坏应用程序。
E/DatabaseUtils﹕ Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13175)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2044)
at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:615)
at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
at android.os.Binder.execTransact(Binder.java:388)
at dalvik.system.NativeStart.run(Native Method)
任何有关为什么只发布apk的帮助的帮助将非常感谢。