2017-03-02 10 views
0

を見つけることができません。これが実行されるとGoogleApiAvailability.getErrorDialogは()私はこのコードを持っている文字列リソース

GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance(); 
String msg = getString(R.string.common_google_play_services_update_text); 
Log.e(TAG, msg); 
Dialog errDlg = googleAPI.getErrorDialog(MyActivity.this, result, 1111, listener); 

、文字列common_google_play_services_update_textが正しくLogCatに書かれていますが、getErrorDialog()は、この例外がスローされます。

java.lang.NoSuchFieldError: No static field common_google_play_services_update_text of type I in class Lcom/google/android/gms/R$string; or its superclasses (declaration of 'com.google.android.gms.R$string' appears in /data/app/com.mygame-1/base.apk)

どうすればこの問題を解決できますか?

答えて

0

エラーNoSuchFieldErrorは、クラスに指定された名前のフィールドがないことを意味します。アプリケーションがオブジェクトの指定されたフィールドにアクセスまたは変更しようとしたときに、そのオブジェクトがそのフィールドを持たない場合にスローされます。通常、このエラーはコンパイラによってキャッチされ、クラスの定義に互換性がない場合にのみ実行時に発生します。

また、再コンパイルされたクラスファイルに存在しなくなったフィールドを参照している古いコードがある可能性があります。あなたはそれを確認することがありますhere

The solution is to clean out all the class files and compile everything from fresh.

Update: If you still get the same error after recompiling everything, then you're probably compiling against one version of an external library and using another at runtime.

What you need to do now is first identify the class that is causing the problem (it looks like you have done this already) and then run your application with the -verbose:class command line option. It will dump a lot of class loading information on your standard out and you'll be able to find out where the problematic class is exactly loaded from.

希望します。

+0

コードが実行されると、文字列common_google_play_services_update_textがLogCatに正しく書き込まれます。したがって、getErrorDialog()ではエラーでなければなりません。 – activity

関連する問題