내 응용 프로그램 프로젝트에 중포 기지를 추가하기위한 레드 라인을 많이 가지고 내 응용 프로그램에 인증을 추가하려고하지만 잘 작동하지 않은 것 같다.
나는 빨간 선이 많으며 어떤 종류의 문제가 발생했는지 이해하지 못합니다. 이 문제를 해결하도록 도와 주시겠습니까? 감사합니다.
내 응용 프로그램 프로젝트에 중포 기지를 추가하기위한 레드 라인을 많이 가지고 내 응용 프로그램에 인증을 추가하려고하지만 잘 작동하지 않은 것 같다.
나는 빨간 선이 많으며 어떤 종류의 문제가 발생했는지 이해하지 못합니다. 이 문제를 해결하도록 도와 주시겠습니까? 감사합니다.
여기서 용액은, build.gradle이 추가 (모듈 애플리케이션)
dependencies {
compile 'com.google.firebase:firebase-auth:10.0.1'
.....
}
문제가 해결.
이것은 당신이 당신의 프로젝트에 BaseActivity를 추가하지 않은 생각 내 코드
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.kse.jackieapp"
minSdkVersion 23
targetSdkVersion 25
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:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
입니다.
여기에 전체 데모 - 당신은 문제가있는 경우 알려줘이 Firebase demo
와 프로젝트 비교하려고합니다.
와 BaseActivity를 교체해야하지만, 더 문제가 있었다. 스크린 샷을 업로드하겠습니다. –
내 기본 동작의 "로드 중"을 컴파일 할 수 없습니다. –
공유 오류 로그 ... – Shane
모든 별표를 참조하십시오.
@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);
if (result.**isSuccess**()) {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = result.**getSignInAccount**();
firebaseAuthWithGoogle(account);
} else {
// Google Sign In failed, update UI appropriately
// [START_EXCLUDE]
updateUI(null);
// [END_EXCLUDE]
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.**activity_google**);
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
// [START_EXCLUDE silent]
showProgressDialog();
// [END_EXCLUDE]
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
if (!task.isSuccessful()) {
Log.w(TAG, "signInWithCredential", task.getException());
Toast.makeText(**GoogleSignInActivity**.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
// [START_EXCLUDE]
hideProgressDialog();
// [END_EXCLUDE]
}
});
}
private void updateUI(FirebaseUser user) {
hideProgressDialog();
if (user != null) {
mStatusTextView.setText(getString(R.string.**google_status_fmt**, user.getEmail()));
mDetailTextView.setText(getString(R.string.**firebase_status_fmt**, user.getUid()));
findViewById(R.id.sign_in_button).setVisibility(View.GONE);
findViewById(R.id.sign_out_and_disconnect).setVisibility(View.VISIBLE);
} else {
mStatusTextView.setText(R.string.**signed_out**);
mDetailTextView.setText(null);
findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
findViewById(R.id.sign_out_and_disconnect).setVisibility(View.GONE);
}
}
공유 코드 및 build.gradle (모듈 응용 프로그램) –
당신은 당신의 코드에 BaseActivity를 추가해야하거나 내가 기본 활동을 추가 AppCompactActivity – Shane