지 않았't 찾스트 클래스 경로:DexPathList?
내 응용 프로그램이 잘 작동하는 경우 내에서 테스트를 사용하여 실제 장치가 USB 안드로이드 스튜디오에.그러나 때 나는 경우 다른 장치로 설치가있다,그것은 작동하지 않습니다.응용 프로그램 추락했다.내가 찾지 못했른 방법으로 문제를 해결합니다.오류는 아래와 같습니다:
FATAL EXCEPTION: main Process: com.w3xplorers.cmch,PID: 17715 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.w3xplorers.cmch/com.w3xplorers.cmch.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.w3xplorers.cmch.MainActivity" on path: DexPathList[[zip file "/data/app/com.w3xplorers.cmch-1/base.apk"],nativeLibraryDirectories=[/data/app/com.w3xplorers.cmch-1/lib/arm, /system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2395)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.w3xplorers.cmch.MainActivity" on path: DexPathList[[zip file "/data/app/com.w3xplorers.cmch-1/base.apk"],nativeLibraryDirectories=[/data/app/com.w3xplorers.cmch-1/lib/arm, /system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1085)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2385)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
atcom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) Suppressed: java.lang.ClassNotFoundException: com.w3xplorers.cmch.MainActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
나의 명단은 다음과 같습니다.
`<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.w3xplorers.cmch">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<application
android:name="com.w3xplorers.cmch.EnableMultiDex"
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="com.w3xplorers.cmch.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.w3xplorers.cmch.HomeActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.w3xplorers.cmch.QuickSms"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.w3xplorers.cmch.GroupSms"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.w3xplorers.cmch.SelfSms"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.w3xplorers.cmch.Contact"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.w3xplorers.cmch.Favourite"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.w3xplorers.cmch.Info"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name="com.w3xplorers.cmch.Dialog" />
</application>
</manifest>`
Gradle below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.w3xplorers.cmch"
minSdkVersion 13
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
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.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha5'
compile 'com.android.support:design:25.3.0'
compile 'com.andreabaccega:android-form-edittext:1.0.3'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
}
19
19
가을프로젝트 수준다.gradle파일을 감소 버전의 gradle 의 종속성을 아무것도보다 낮은2.3.0말 사용2.2.3
다음 깨끗-->build-->설치 디버깅을 만족하기 위해 다른 장치->될 수 있***확인다음!
나는 생각한 문제가 AndroidStudio 는 사"즉시 실행되"대의 컴파일하고 설치하면 신선한니다.
해"즉시 실행되"에서 파일을->Settings->을 구축,실행,배포->즉시 실행합니다.
에서의 응용 프로그램,태그를 변경
가
도움이 되기를 바랍:)
더 많은 정보:
https://developer.android.com/studio/build/multidex.html
을 따라하는 공식 문서: https://developer.android.com/studio/build/multidex.html#mdex-gradle
니다.gradle:
YourApp 클래스
나는 자바를 사용 8 을 지원한 후 업데이트 안드로이드 스튜디오 3.5
다음 줄을 추가에서 빌드.gradle file:
할 수 있는 설명서를 확인하기: https://developer.android.com/studio/write/java8-support
당신이 말한 대로,당신은 응용 프로그램을 구축하고 귀하의 휴대 전화에 밀려 USB 를 통해,내가 믿음을 복사 apk 에서 귀하의 디렉토리 구축하려고 밀어 및 실행에서 다른 장치입니다. 십시오를 구축하려고하지 않고 apk 타겟팅 또는 연결하는 모든 장치 또는 에뮬레이터 무엇을 의미하는 건축의 터미널에서 없이 연결하는 장치입니다. 거나 작동하나 보여줄 것이 무언가이다.
나는 또한 직면 유사한 문제입니다. 내 경우에 문제를 해결을 추가하여 아래buildTypes
또한 사용
고
그것은 마치 마법처럼 작동하 for me:)
어쩌면 당신은 don't 응용 프로그램을 만들 Multidex.설치(this);
에서 빌드.gradle 추가
또한 종속성을 추가로
내가 찾지 못했을위한 완벽한 솔루션이 내 문제입니다.하지만 내가드에 구글 플레이에서 다운로드,거기입니다.이것이 가장 이상한 솔루션을 내가 지금까지 발견된다.
그할 수 있기 때문에 당신은 즉시 실행 기능을 사용하도록 하려고 그냥용 인스턴트를 실행.
를 실행하는 사람들로 이를 사용하여 코 틀린을 위해 자신의 계측 테스트:
*을 유지 하는 마음에 공백을 메서드 이름이만 작동에 대한 JVM 을 테스트하지안드로이드 계측 시험**(로 주목에 의해 제이크 와튼]1,그는 또한이 해결할 수 있습니다 미래에)
순간에 빠르게 액세스할 수 있습니를 실행하는 테스트는 다음과 같:
테스트는 출력을 말합니다:
와 로그를 말한다:
동환 출력이 예외:
당신이 볼 수있는,오는데 많은 도움이 되지 않는다,그래서 나는 여기에서 희망하는 사람들이 지금 대답. 해결책은 간단하다,사용하는 유효한 같은 이름:
명확한 프로젝트 무효화 캐시/에서 다시 시작하에서 당신의 안드로이드 스튜디오 파일 섹션에서,그것은 나를 위해 작동합니다.
참조할 수 있습니다 Mohaimanul chowdhury 는's answer. 당신이'다시 사용하여 사용자 지정 응용 프로그램 클래스에서 변경을 확장 응용 프로그램을 MultiDexApplication
예를 들어
하기
그것은 수정 나의 문제
할 수 있을 확인합니다.가 서면으로 틀린 대신 Java?
나는 장애인 코 틀린 및 쓰기 활동으로 틀린 발생이 오류가 있습니다.
변 확장 클래스의를 클래스는 응용 프로그램
에서
공급다.장 응용 프로그램{...}
하는
공공급다.장 MultiDexApplication{...}
에 대한 자세한 설명에 따라 공식 문서:https://developer.android.com/studio/build/multidex.html#mdex-gradle
그것은 나를 위해 일
그것은 보이는 랜덤하게 이러한 문제를 해결해 줍니다. 나는 단순히 변화:안드로이드 이름을 MultiDex 안드로이드에서,그것을 실행한 다음 변경은 그것을 자신의 응용 프로그램입니다.