나는 앱을 가지고 있고 그것을위한 단위 테스트 케이스를 작성 중이다.
내 테스트 케이스는 큰 경고의 목록과 1 오류
이어 다음 링크 및 하위 페이지 Building Instrumented Unit TestsInstrumented Android Unit Test and ProGuard
오류 및 일부 경고 내가 디버그에서 난독 화를 제거하면, 내가 할
Warning:there were 10 unresolved references to classes or interfaces. You may need to add missing library jars or update their versions. If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass) Warning:there were 5 instances of library classes depending on program classes. You must avoid such dependencies, since the program classes will be processed, while the library classes will remain unchanged. (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency) Warning:there were 3 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile the code. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember) Warning:Exception while processing task java.io.IOException: Please correct the above warnings first. :app:transformClassesAndResourcesWithProguardForDebugAndroidTest FAILED
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebugAndroidTest'. java.io.IOException: Please correct the above warnings first.
을 제공합니다 64K 오류!
Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
내가 뭘 잘못하고 있니?
응용 프로그램 build.gradle
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.tyagiabhinav.xyz"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:support-annotations:24.2.0'
......
androidTestCompile 'com.android.support:support-annotations:24.2.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
}
테스트 자바 클래스
package com.tyagiabhinav.xyz;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import com.tyagiabhinav.xyz.Util.PrefHelper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Created by abhinavtyagi on 24/08/16.
*/
@RunWith(AndroidJUnit4.class)
public class PrefTester {
Context mMockContext;
private PrefTester() {
super();
}
@Before
public void setUp() {
mMockContext = InstrumentationRegistry.getTargetContext();
PrefHelper.init(mMockContext);
}
@Test
public void testSharedPref(){
Assert.assertEquals(false,PrefHelper.isLoggedIn());
}
}
프로 가드를 제거하면 64k 오류가 발생합니다. 내 코드는 큰 코드가 아닙니다. 작은 응용 프로그램입니다. 하지만 어떻게 든이 테스트 케이스를 작성한 후에는 컴파일하는 동안 64K 오류가 발생합니다. –