2017-07-24 36 views
1

我最近開始擺弄Jenkins和Android。我在我自己的服務器上安裝了jenkins,並且安裝了graddle和android sdk。 請找我的配置如下: jenkins configuration安卓apk版與jenkins崩潰在設備上。一切工作正常在Android工作室

我得到生成的apk文件的列表,但在安裝設備上的調試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)  

任何線索什麼會出錯?

搖籃文件(默認生成):

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> 
+0

添加清單 – Zoe

+0

完成後,在原始文章 – Triplus

+0

中確保apk使用v1進行簽名,而不是v2。 V2是Android 7附帶的簽名方式。 – Zoe

回答

0

我固定的問題我自己。我用graddle命令「assemble」而不是「build」。接下來我確定jkk被添加到jenkins。

我通過在我的項目工作區中手動測試和執行「gradlew assemble」來解決所有問題。

+0

你能告訴我如何完美地設置jenkins嗎? – Mahesh

相關問題