2013-12-23 2 views
3

gradle을 사용하여 내 안드로이드 프로젝트를 빌드하고 다소 이상한 문제가 발생했습니다.처음으로 "gradlew build"를 실행할 때 Proguard에서 참조 된 클래스를 찾을 수 없습니다.

"gradlew build"를 처음 실행하면 proguard가 참조 된 클래스를 찾을 수 없어 빌드가 중단됩니다. 그러나 "gradlew build"를 다시 실행하면 빌드가 성공적으로 완료 될 수 있습니다. 내가 Gradle을 0.7을 사용하고

Warning: com.actionbarsherlock.sample.demos.ActionItems: can't find superclass or interface com.actionbarsherlock.app.SherlockActivity 
Warning: com.actionbarsherlock.sample.demos.ActionModes: can't find superclass or interface com.actionbarsherlock.app.SherlockActivity 
Warning: com.actionbarsherlock.sample.demos.ActionModes$AnActionModeOfEpicProportions: can't find superclass or interface com.actionbarsherlock.view.ActionMode$Callback 
Warning: com.actionbarsherlock.sample.demos.ActionModesNoActionBar: can't find superclass or interface com.actionbarsherlock.app.SherlockActivity 
Warning: com.actionbarsherlock.sample.demos.ActionModesNoActionBar$AnActionModeOfEpicProportions: can't find superclass or interface com.actionbarsherlock.view.ActionMode$Callback 
Warning: com.actionbarsherlock.sample.demos.ActionProviders: can't find superclass or interface com.actionbarsherlock.app.SherlockActivity 
Warning: com.actionbarsherlock.sample.demos.ActionProviders$SettingsActionProvider: can't find superclass or interface com.actionbarsherlock.view.ActionProvider 
.... 

다음과 같이

D:\project\abs-demo>gradlew clean 
D:\project\abs-demo>gradlew build  // first time, fail 
D:\project\abs-demo>gradlew build  // second time, succeed 

오류 메시지입니다. 그리고 내 build.gralde는 :

apply plugin: 'android' 

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile "com.android.support:support-v4:18.0.+" 
    compile fileTree(dir: 'libs', include: '*.jar') 
    compile 'com.actionbarsherlock:actionbarsherlock:[email protected]' 
} 

android { 
    compileSdkVersion 19 
    buildToolsVersion "18.0.0" 

    buildTypes { 
     release { 
      runProguard true 
      proguardFile getDefaultProguardFile('proguard-android.txt') 
      proguardFile 'proguard-project.txt' 
     } 
    } 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     // Move the tests to tests/java, tests/res, etc... 
     instrumentTest.setRoot('tests') 

     // Move the build types to build-types/<type> 
     // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
     // This moves them out of them default location under src/<type>/... which would 
     // conflict with src/ being used by the main source set. 
     // Adding new build types or product flavors should be accompanied 
     // by a similar customization. 
     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
    } 
} 

나는 my project here을 업로드했습니다.

내가 잘못 했습니까? 아니면 gradle의 버그입니까?

+0

경로에서 gradle을 사용할 때 동일한 문제가 있습니다. 첫 번째 빌드가 실패하고 두 번째 것은 정상입니다. 그래서 다음 Proguard와의 작업이 너무 일찍 실행 * 호출 구축 * 이전에 의해 생성 된 클래스에서 작동과 같은 순서대로 실행하면 "Gradle을 청소 assembleDebug" "Gradle을 정리 빌드" 잘 작동 :( – Harri

+3

는 소리 –

+0

. 어떤 세부 사항을 추가 할 수 있습니까? 어떤 버전의 Gradle 플러그인을 사용하고 있습니까? lib에 자체 build.gradle이 있습니까? PullToRefresh가 소스 파일이나 라이브러리 Jar입니까? 문제가 재현되지 않는 것 같습니다. –

답변

1

이 문제는 Android Gradle 플러그인 버전 0.7.0 및 0.7.1 : issue 63944issue 64039에서 발생합니다.

관련 문제