2017-08-29 122 views
-1

Nexus 4 API 22.Android。幾秒鐘後應用程序將中斷。工作

我正在使用Ubuntu。 Android Studio 3.0。
我運行在一個標準的仿真器的應用和得到這個錯誤

08-29 14:21:03.962 5343-5343/com.knowledgecity.us_site I/MultiDex: VM with version 2.1.0 has multidex support 
08-29 14:21:03.962 5343-5343/com.knowledgecity.us_site I/MultiDex: Installing application 
08-29 14:21:03.962 5343-5343/com.knowledgecity.us_site I/MultiDex: VM has multidex support, MultiDex support library is disabled. 
08-29 14:21:04.058 5343-5343/com.knowledgecity.us_site I/InstantRun: starting instant run server: is main process 
08-29 14:21:04.067 5343-5343/com.knowledgecity.us_site I/MultiDex: Installing application 
08-29 14:21:04.067 5343-5343/com.knowledgecity.us_site I/MultiDex: VM has multidex support, MultiDex support library is disabled. 
08-29 14:21:04.361 5343-5343/com.knowledgecity.us_site W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 
08-29 14:21:04.420 5343-5355/com.knowledgecity.us_site I/art: Background sticky concurrent mark sweep GC freed 4119(386KB) AllocSpace objects, 4(64KB) LOS objects, 1% free, 2MB/2MB, paused 747us total 101.676ms 
08-29 14:21:04.567 5343-5355/com.knowledgecity.us_site W/art: Suspending all threads took: 10.350ms 
08-29 14:21:04.568 5343-5355/com.knowledgecity.us_site I/art: Background sticky concurrent mark sweep GC freed 71(34KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 3MB/3MB, paused 10.906ms total 39.420ms 
08-29 14:21:04.583 5343-5343/com.knowledgecity.us_site I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead. 
08-29 14:21:04.708 5343-5355/com.knowledgecity.us_site W/art: Suspending all threads took: 8.592ms 
08-29 14:21:04.709 5343-5355/com.knowledgecity.us_site I/art: Background partial concurrent mark sweep GC freed 238(16KB) AllocSpace objects, 0(0B) LOS objects, 36% free, 6MB/10MB, paused 9.362ms total 21.672ms 
08-29 14:21:04.760 5343-5404/com.knowledgecity.us_site D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 

                     [ 08-29 14:21:04.761 5343: 5343 D/   ] 
                     HostConnection::get() New Host Connection established 0xa3c490b0, tid 5343 


                     [ 08-29 14:21:04.763 5343: 5343 W/   ] 
                     Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 
08-29 14:21:04.764 5343-5343/com.knowledgecity.us_site D/Atlas: Validating map... 
08-29 14:21:04.793 5343-5404/com.knowledgecity.us_site I/OpenGLRenderer: Initialized EGL, version 1.4 
08-29 14:21:04.793 5343-5404/com.knowledgecity.us_site W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 
08-29 14:21:04.799 5343-5404/com.knowledgecity.us_site D/EGL_emulation: eglCreateContext: 0xa3c21700: maj 2 min 0 rcv 2 
08-29 14:21:04.945 5343-5404/com.knowledgecity.us_site D/EGL_emulation: eglMakeCurrent: 0xa3c21700: ver 2 0 
08-29 14:21:04.957 5343-5404/com.knowledgecity.us_site D/OpenGLRenderer: Enabling debug mode 0 
08-29 14:21:05.067 5343-5404/com.knowledgecity.us_site D/EGL_emulation: eglMakeCurrent: 0xa3c21700: ver 2 0 
08-29 14:21:05.128 5343-5343/com.knowledgecity.us_site W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView 
08-29 14:21:05.192 5343-5380/com.knowledgecity.us_site A/libc: Fatal signal 4 (SIGILL), code 2, fault addr 0xb72085ce in tid 5380 (Queue) 

我試過Genimotion同樣的事情。 Android 4和5.0 6.0。一切都是一樣的。

但是,如果你在真正的手機上做同樣的事情。順便說一句,我有Android 6.0。這一切都很好。在其他手機上也檢查過。

即事實證明,模擬器或Ubuntu有一些錯誤。

可以做些什麼來糾正這個錯誤?

預先感謝您


順便說一句,我注意到這樣的事情。如果我在模擬器上禁用Internet,那麼應用程序將啓動。但是如果我打開互聯網登錄,我收到一個錯誤。

即應用程序試圖通過模擬器使用互聯網,我現在得到一個錯誤。

誰遇到這一點)))

+0

檢查此https://stackoverflow.com/questions/44603154/how-to-fix-android-4-4-2-error-classnotfoundexception-didnt-find-class-com-go/44603205#44603205 –

回答

2

添加下面的代碼在你的gradle產出:

defaultConfig { 
    multiDexEnabled true 
} 
dependencies { 
    compile 'com.android.support:multidex:1.0.1' 
} 

創建一個類,讓我們將其命名爲AppMultiDexApplication擴展這樣的:

import android.support.multidex.MultiDexApplication; 

public class App extends MultiDexApplication { 
    //you can leave this empty or override methods if you like so the thing is that you need to extend from MultiDexApplication 

} 

在你的清單中添加App爲您的應用程序這樣的名字

<application 
     android:name=".App" // <-- this is the important line! 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name"> 

添加所有內容後,請進行清潔構建,現在應該可以工作:)。

+0

你不會相信我)。但一切已經註冊我 – Prost

+1

仍然收到錯誤? –

+0

'是的。我更新了這個問題。請看這裏 – Prost

3

只是使multidex:請按照下列步驟

android {  
defaultConfig { 
    // Enabling multidex support. 
    multiDexEnabled true 
} 
} 
dependencies { 
compile 'com.android.support:multidex:1.0.0' 
} 

創建一類像這樣

public class Multi_Dex extends Application { 
@Override 
protected void attachBaseContext(Context base) { 
    super.attachBaseContext(base); 
    MultiDex.install(this); 
} 
} 

現在在manifiest文件加這個

<application 
    android:name=".Multi_Dex" 
    android:allowBackup="true" 
    android:icon="@drawable/logo" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
相關問題