私のアプリケーションでGoogleログインのAPIを設定しています。起動時にillegalAccessErrorを取得しています。私はボタンで、Googleの記号をクリックしてアプリとLooper.prepare()エラーログがワーカースレッドのタスク例外:java.lang.IllegalAccessError AND Looper.prepare()を呼び出していないスレッド内でハンドラを作成できません。
09-03 02:34:12.615 13855-14016/com.xyz I/OpenGLRenderer: Initialized EGL, version 1.4
09-03 02:34:13.027 13855-13944/com.xyz D/FA: Connected to remote service
09-03 02:34:13.027 13855-13944/com.xyz V/FA: Processing queued up service tasks: 1
09-03 02:34:13.034 13855-13944/com.xyz E/FA: Task exception on worker thread: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.xyz-2/split_lib_dependencies_apk.apk:classes17.dex): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
09-03 02:34:18.028 13855-13944/com.xyz V/FA: Inactivity, disconnecting from AppMeasurementService
09-03 02:34:33.162 13855-13944/com.xyz V/FA: Activity paused, time: 362334438
09-03 02:34:33.165 13855-15188/com.xyz E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
09-03 02:34:33.165 13855-15188/com.xyz D/AppTracker: App Event: stop
09-03 02:34:33.196 13855-13855/com.xyz V/FA: onActivityCreated
09-03 02:34:33.220 13855-13944/com.xyz V/FA: Activity resumed, time: 362334496
09-03 02:34:33.221 13855-15190/com.xyz E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
09-03 02:34:33.221 13855-15190/com.xyz D/AppTracker: App Event: start
09-03 02:34:33.296 13855-13944/com.xyz V/FA: Activity paused, time: 362334572
09-03 02:34:33.297 13855-15191/com.xyz E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
09-03 02:34:33.298 13855-15191/com.xyz D/AppTracker: App Event: stop
09-03 02:34:34.298 13855-13944/com.xyz D/FA: Application backgrounded. Logging engagement
09-03 02:34:34.304 13855-13944/com.xyz I/FA: Tag Manager is not found and thus will not be used
09-03 02:34:34.317 13855-13944/com.xyz D/FA: Logging event (FE): _e, Bundle[{_o=auto, _et=20742}]
09-03 02:34:34.319 13855-13944/com.xyz V/FA: Using measurement service
09-03 02:34:34.319 13855-13944/com.xyz V/FA: Connecting to remote service
09-03 02:34:34.328 13855-13944/com.xyz D/FA: Connected to remote service
09-03 02:34:34.328 13855-13944/com.xyz V/FA: Processing queued up service tasks: 1
09-03 02:34:34.332 13855-13944/com.xyz E/FA: Task exception on worker thread: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.xyz-2/split_lib_dependencies_apk.apk:classes17.dex): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
09-03 02:34:39.339 13855-13855/com.xyz D/LoginActivity: handleSignInResult:false
09-03 02:34:39.340 13855-13944/com.xyz V/FA: Activity resumed, time: 362340616
09-03 02:34:39.341 13855-15331/com.xyz E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
09-03 02:34:39.341 13855-15331/com.xyz D/AppTracker: App Event: start
09-03 02:34:39.367 13855-13944/com.xyz V/FA: Inactivity, disconnecting from AppMeasurementService
09-03 02:34:49.054 13855-13944/com.xyz V/FA: Activity paused, time: 362349528
09-03 02:34:49.057 13855-15634/com.xyz E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
09-03 02:34:49.057 13855-15634/com.xyz D/AppTracker: App Event: stop
09-03 02:34:49.093 13855-13855/com.xyz D/FirebaseApp: Notifying background state change listeners.
09-03 02:34:50.089 13855-13944/com.xyz D/FA: Application backgrounded. Logging engagement
09-03 02:34:50.092 13855-13944/com.xyz D/FA: Logging event (FE): _e, Bundle[{_o=auto, _et=8912}]
09-03 02:34:50.092 13855-13944/com.xyz V/FA: Using measurement service
09-03 02:34:50.092 13855-13944/com.xyz V/FA: Connecting to remote service
09-03 02:34:50.111 13855-13944/com.xyz D/FA: Connected to remote service
09-03 02:34:50.111 13855-13944/com.xyz V/FA: Processing queued up service tasks: 1
09-03 02:34:50.116 13855-13944/com.xyz E/FA: Task exception on worker thread: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.xyz-2/split_lib_dependencies_apk.apk:classes17.dex): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
09-03 02:34:55.153 13855-13944/com.xyz V/FA: Inactivity, disconnecting from AppMeasurementService
これは、(プロジェクトレベル)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.grade(アプリケーションレベル)
私build.gradeですapply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.xyz"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-auth:9.0.0'
testCompile 'junit:junit:4.12'
}
これは、私がここで起こっていただきました、本当にわからない私のログイン・アクティビティー
public class LoginActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener, View.OnClickListener {
private static final String TAG = "LoginActivity";
private static final int RC_SIGN_IN = 9001;
private GoogleApiClient mGoogleApiClient;
private TextView mStatusTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_activity);
loadFontsOnStartUp();
GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail().build();
mGoogleApiClient = new GoogleApiClient.Builder(this).enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions).build();
findViewById(R.id.google_login).setOnClickListener((View.OnClickListener) this);
mStatusTextView = (TextView) findViewById(R.id.testViewForLoginGoogle);
}
/**
* Adding custom font "berkshireswash" to the app title
* Adding custom font "Lato-Light" to all text on login screen
*/
public void loadFontsOnStartUp() {
Typeface customFontNunitoRegular = Typeface.createFromAsset(getAssets(), "fonts/Nunito-Regular.ttf");
Typeface customFontBerkshire = Typeface.createFromAsset(getAssets(), "fonts/berkshireswash-regular.ttf");
TextView appName = (TextView) findViewById(R.id.app_name);
appName.setTypeface(customFontBerkshire);
Button fbLogin = (Button) findViewById(R.id.facebook_login);
fbLogin.setTypeface(customFontNunitoRegular);
Button googleLogin = (Button) findViewById(R.id.google_login);
googleLogin.setTypeface(customFontNunitoRegular);
Button loginButton = (Button) findViewById(R.id.login_button);
loginButton.setTypeface(customFontNunitoRegular);
TextView forgotPasswordTextView = (TextView) findViewById(R.id.forgot_password);
forgotPasswordTextView.setTypeface(customFontNunitoRegular);
TextView signUpTextView = (TextView) findViewById(R.id.sign_up);
signUpTextView.setTypeface(customFontNunitoRegular);
TextView termsConditionsTextView = (TextView) findViewById(R.id.terms_and_conditons);
termsConditionsTextView.setTypeface(customFontNunitoRegular);
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.d(TAG, "onConnectionFailed:" + connectionResult);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.google_login:
signIn();
break;
}
}
private void signIn() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
}
}
private void handleSignInResult(GoogleSignInResult result) {
Log.d(TAG, "handleSignInResult:" + result.isSuccess());
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
mStatusTextView.setText(getString(R.string.tempSignInGoogleTestString, acct.getEmail()));
updateUI(true);
} else {
// Signed out, show unauthenticated UI.
updateUI(false);
}
}
private void updateUI(boolean signedIn) {
if (signedIn) {
findViewById(R.id.login_button).setVisibility(View.GONE);
}
}
}
です。 Facebookのsdkを追加していたので、それはバージョン26でサポートされていなかったため、Android SGDのバージョンを25に変更しました。それは動作しなくなりました。したがって、動作していたときにすべてをロールバックしましたが、今。どんなアイデアがここで起こっている?
com.google.android.gmsを解決できませんでした:play-services-auth:11.2.0 –
11.2で 'maven.google.com'リポジトリを使用する際の注意.0リリースノート私はリンクしていますか? – ianhanniballake