오픈 소스 Google Authenticator을 기존 Eclipse 프로젝트에서 Gradle 기반 Android Studio 프로젝트로 변환했습니다. 전환 후 프로젝트가 잘 작성됩니다. GitHub에서 사용할 수있는 완전히 작동하는 Android Studio 프로젝트를 만들었습니다.themes.xml에 "No resource found"가 표시되는 Android Gradle applicationId 설정
그러나 build.gradle
의 applicationId
을 다른 ID로 변경하여 기기에서 내 인증 용 Google OTP와 함께 설치할 수있게되었습니다. ApplicationId versus PackageName에 대한 나의 이해에 따르면, 이것은 갈 길이되어야합니다.
build.gradle
이제 다음과 같습니다
apply plugin: 'com.android.application'
android {
compileSdkVersion 14
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "invalid.mydomain.project"
minSdkVersion 7
targetSdkVersion 14
testApplicationId "invalid.mydomain.project.tests"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
AndroidManifest.xml
이전 패키지 이름을 포함하는 동안 :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.apps.authenticator2"
android:versionCode="21" android:versionName="2.21">
...
지금 빌드 Gradle을을하고,이 자원 것으로, 오류 결과를 패키지 이름으로 찾을 수 없습니다.
:app:processDebugResources
E:\Martin\Projects\google-authenticator-android\app\build\intermediates\res\debug\values\values.xml:199: error: Error: No resource found that matches the given name: attr 'com.google.android.apps.authenticator2:color'.
E:\Martin\Projects\google-authenticator-android\app\build\intermediates\res\debug\values-v11\values.xml:16: error: Error: No resource found that matches the given name: attr 'com.google.android.apps.authenticator2:color'.
실제로 실패 명령은 다음과 같습니다
D:\java_dev\Android\android-sdk\build-tools\21.1.2\aapt.exe package -f --no-crunch -I D:\java_dev\Android\android-sdk\platforms\android-14\android.jar -M E:\Martin\Projects\google-authenticator-android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S E:\Martin\Projects\google-authenticator-android\app\build\intermediates\res\debug -A E:\Martin\Projects\google-authenticator-android\app\build\intermediates\assets\debug -m -J E:\Martin\Projects\google-authenticator-android\app\build\generated\source\r\debug -F E:\Martin\Projects\google-authenticator-android\app\build\intermediates\res\resources-debug.ap_ --debug-mode --custom-package com.google.android.apps.authenticator2 -0 apk
내 질문은 지금이 예상되는 동작이며, 지금은 정말/검색하려면 *.xml
파일에 패키지 이름을 교체해야합니까? 내 이해에서, 정확히 ApplicationId
피하려고 시도합니다.
Android Studio가 아닌 Android SDK 빌드 도구에 문제가 있습니까?
Windows 및 Linux에서 제공 한 코드를 모두 깨끗하게 정리했기 때문에이 문제가 재현되었으므로 은과 관련이 없습니다.
아마도 대부분 컴파일 된 파일을 포함하고 있기 때문에 빌드 폴더를 삭제하려고 할 수 있습니다.gradle은 src 관련 정보를 참조하기 위해 이전 패키지 식별자를 사용하고있는 것으로 보입니다. 이는 좋은 – degill
'gradle clean'이며 수동으로 빌드 폴더를 삭제해도 아무 것도 변경되지 않습니다. 색상을 해석 할 때'applicationId'가'packageName'보다 더 많이 사용되는 것 같습니다. 다른 자원 일 수도 있습니다. –
왜 applicationID가 사용 된 것이라고 생각하십니까? 그것은 응용 프로그램 도메인 내에서가 아니라 패키지 내에서 색상을 바꿀 수 없다고 말합니다 ... build.gradle에 모든 종속성을 추가 했습니까? – degill