gpt4 book ai didi

android - 带有jenkins的android apk生成在设备上崩溃。在android studio中一切正常

转载 作者:行者123 更新时间:2023-12-03 04:27:10 25 4
gpt4 key购买 nike

我最近开始修改Jenkins和android。我在自己的服务器上安装了jenkins,还安装了graddle和android sdk。
请在下面找到我的配置:
jenkins configuration

我得到了生成的.apk文件的列表,但是在设备上安装debug-app.apk时,它崩溃并显示以下错误:

07-24 19:18:34.043 26394-26394/bikeparts.triplustutorials.be.bikeparts E/AndroidRuntime: FATAL EXCEPTION: main
Process: bikeparts.triplustutorials.be.bikeparts, PID: 26394
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{bikeparts.triplustutorials.be.bikeparts/bikeparts.triplustutorials.be.bikeparts.LoginActivity}: java.lang.ClassNotFoundException: Didn't find class "bikeparts.triplustutorials.be.bikeparts.LoginActivity" on path: DexPathList[[zip file "/data/app/bikeparts.triplustutorials.be.bikeparts-2/base.apk"],nativeLibraryDirectories=[/data/app/bikeparts.triplustutorials.be.bikeparts-2/lib/arm64, /system/lib64, /vendor/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "bikeparts.triplustutorials.be.bikeparts.LoginActivity" on path: DexPathList[[zip file "/data/app/bikeparts.triplustutorials.be.bikeparts-2/base.apk"],nativeLibraryDirectories=[/data/app/bikeparts.triplustutorials.be.bikeparts-2/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

有什么线索会出问题吗?

Gradle文件(默认生成):
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "bikeparts.triplustutorials.be.bikeparts"
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'
}
}
}

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:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}

表现:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="bikeparts.triplustutorials.be.bikeparts">
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".LoginActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

最佳答案

我自己解决了这个问题。我使用了graddle命令“assembly”而不是“build”。接下来,我确保将jdk添加到jenkins。

我通过在项目工作区中手动测试并执行“gradlew assemble”来解决所有问题。

关于android - 带有jenkins的android apk生成在设备上崩溃。在android studio中一切正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45286553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com