Google Play 서비스를 버전 13으로 업데이트 한 후 오류가 발생했습니다.
이 오류를 어떻게 해결할 수 있습니까?
원인 : java.lang.illegalargumentexception 11-01 11 : 08 : 12.845 : E / AndroidRuntime (28885) : 원인 : java.lang.IllegalStateException : 앱의 AndroidManifest.xml에있는 메타 데이터 태그에 올바른 값이 없습니다. . 4030500을 예상했지만 0을 찾았습니다. 요소 내에 다음 선언이 있어야합니다.
google-play-services_lib 매니페스트 :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms"
android:versionCode="4030530"
android:versionName="4.0.30 (889083-30)" >
<uses-sdk android:minSdkVersion="8"/>
</manifest>
public void loginGooglePlus() {
aHelper.setup(this, GameHelper.CLIENT_APPSTATE | GameHelper.CLIENT_GAMES);
mHelper = aHelper.getAppStateClient();
//crash is here
mHelper.connect();
}
전체 오류 로그 :
11-01 11:38:13.507: E/AndroidRuntime(31297): FATAL EXCEPTION: main
11-01 11:38:13.507: E/AndroidRuntime(31297): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.company.application.android.aja/com.company.application.android.aja.BeetleBattleAndroidActivity}: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.app.ActivityThread.access$600(ActivityThread.java:134)
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.os.Handler.dispatchMessage(Handler.java:99)
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.os.Looper.loop(Looper.java:154)
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.app.ActivityThread.main(ActivityThread.java:4624)
11-01 11:38:13.507: E/AndroidRuntime(31297): at java.lang.reflect.Method.invokeNative(Native Method)
11-01 11:38:13.507: E/AndroidRuntime(31297): at java.lang.reflect.Method.invoke(Method.java:511)
11-01 11:38:13.507: E/AndroidRuntime(31297): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:965)
11-01 11:38:13.507: E/AndroidRuntime(31297): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:732)
11-01 11:38:13.507: E/AndroidRuntime(31297): at dalvik.system.NativeStart.main(Native Method)
11-01 11:38:13.507: E/AndroidRuntime(31297): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
11-01 11:38:13.507: E/AndroidRuntime(31297): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-01 11:38:13.507: E/AndroidRuntime(31297): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-01 11:38:13.507: E/AndroidRuntime(31297): at com.google.android.gms.internal.de.connect(Unknown Source)
11-01 11:38:13.507: E/AndroidRuntime(31297): at com.google.android.gms.appstate.AppStateClient.connect(Unknown Source)
11-01 11:38:13.507: E/AndroidRuntime(31297): at com.company.application.android.aja.BeetleBattleAndroidActivity.loginGooglePlus(BeetleBattleAndroidActivity.java:153)
11-01 11:38:13.507: E/AndroidRuntime(31297): at com.company.application.android.aja.BeetleBattleAndroidActivity.onCreate(BeetleBattleAndroidActivity.java:143)
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.app.Activity.performCreate(Activity.java:4509)
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
11-01 11:38:13.507: E/AndroidRuntime(31297): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
11-01 11:38:13.507: E/AndroidRuntime(31297): ... 11 more
매니페스트에 다음을 추가해야합니다.
<application>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
...
</application>
편집하다:
이 정보는 logcat 오류 메시지와 Google Play 서비스 설정 에서 찾을 수 있습니다 (Brais Gabin에게 감사드립니다).
@ Benoit'a 대답에는 추가 지식으로 대답하는 정확한 솔루션이 있습니다.
1. Benoit가 답변 한 한 가지 방법은 다음과 같은 응용 프로그램 태그를 추가하는 것입니다.AndroidManifest.xml
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
2. we can directly add the version code like
<meta-data android:name="com.google.android.gms.version" android:value="4030500" />
4030500 is version code which is stored inside
google-play-services_lib>res>values>version.xml
Like
<integer name="google_play_services_version">4030500</integer>
Conclusion: Latest google play services requires a version name, which is to be mentioned using <meta-data .. />
inside AndroidManifest.xml
Note: I would strongly recommend to use 1st way
A few things changed since you asked that question. If you're using Google Play services 7.0 or newer, Gradle will automatically merge manifests and include the required meta-data for you.
Citing Ian Lake:
(...) Google Play services 7.0 also has one other time saving feature if you're using Gradle: it automatically includes the
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
entry in your AndroidManifest.xml for you - no need to manually add it! Perfect example of simple Manifest merging where libraries can add required meta-data, receivers, permissions, and anything else they made need - one less thing to forget!
Note: this does not apply to the full play-services or play-services-all-wear AARs - only the granular AARs have this built in.
Just make sure to add the below two meta-data tags to 'your' application's AndroidManifest.xml
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR_API_KEY"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
This solution worked for me.
I imported my existing project from Eclipse to Android Studio, In Eclipse project Integers.xml
was containing hardcoded value as following
<integer name="google_play_services_version">5089000</integer>
causing version conflict with latest version of Play Services being built by Android Studio. after removing this line from Integers.xml
it started working for me.
I did create a file "version.xml" in the res/values folder of the included copy of google services and pasted the code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<integer name="google_play_services_version">4030500</integer>
</resources>
the original copy missed the file and it did solve my problem
If you still having error try this one.
it worked for me
<meta-data
tools:replace="android:value"
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Add <meta-data>
after closing <application>
tag. This solved my problem
'code' 카테고리의 다른 글
Android에서 프로그래밍 방식으로 ScreenSize를 얻는 방법 (0) | 2020.10.31 |
---|---|
Django 나머지 프레임 워크 중첩 된 자체 참조 개체 (0) | 2020.10.31 |
사용자 정의 UITableViewCell에서 자동 레이아웃이 무시됩니다. (0) | 2020.10.31 |
PHP : 숫자 인덱스에서 연관 배열 키를 얻는 방법? (0) | 2020.10.31 |
UIScrollview가 터치 이벤트를 가져옵니다. (0) | 2020.10.31 |