使用Facebook-SDK
时遇到问题。添加库Facebook SDK
时应用程序崩溃。这是我的代码。请帮忙。
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
repositories {
mavenCentral()
}
defaultConfig {
applicationId "com.dreamm.karaokepro"
minSdkVersion 16
targetSdkVersion 23
versionCode 9
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.koushikdutta.ion:ion:2.1.6'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.apptentive:apptentive-android:2.0.1'
compile 'org.scribe:scribe:1.3.7'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'commons-codec:commons-codec:20041127.091804'
compile 'com.google.apis:google-api-services-youtube:v3-rev151-1.20.0'
compile 'com.google.api-client:google-api-client:1.20.0'
compile 'com.google.oauth-client:google-oauth-client:1.20.0'
compile 'com.google.http-client:google-http-client:1.20.0'
compile 'com.google.code.findbugs:jsr305:3.0.1'
compile 'com.google.http-client:google-http-client-jackson2:1.20.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.6.3'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.google.http-client:google-http-client-android:1.20.0'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
transitive = true;
}
compile 'com.github.rampo.updatechecker:library:2.1.8'
compile 'com.facebook.android:facebook-android-sdk:4.+'
}
build.gradle level project
// 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:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
应用程序启动时出现错误
01-28 04:13:57.894 1189-1189 / com.dreamm.karaokepro E / AndroidRuntime: 致命异议:主要 java.lang.VerifyError:com / crashlytics / android / core / CrashlyticsCore 在com.crashlytics.android.Crashlytics。(Crashlytics.java:29) 在com.dreamm.karaokepro.SplashScreen.onCreate(SplashScreen.java:22) 在android.app.Activity.performCreate(Activity.java:5104) 在 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 在android.app.ActivityThread.access $ 600(ActivityThread.java:141) 在 android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1234) 在android.os.Handler.dispatchMessage(Handler.java:99) 在android.os.Looper.loop(Looper.java:137) 在android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) 在java.lang.reflect.Method.invoke(Method.java:511) 在 com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:793) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 在dalvik.system.NativeStart.main(本地方法)
我的代码中出现错误(Fabric.with(this, new Crashlytics());
)
public class SplashScreen extends Activity {
private static final int SPLASH_SHOW_TIME = 5000;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
setContentView(R.layout.splashscreen);
new BackgroundSplashTask().execute();
}
private class BackgroundSplashTask extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... arg0) {
try {
Thread.sleep(SPLASH_SHOW_TIME);
} catch (InterruptedException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
Intent i = new Intent(SplashScreen.this,
MainActivity.class);
i.putExtra("loaded_info", " ");
startActivity(i);
finish();
}
}
}