gpt4 book ai didi

java - 编译 Firebase 和 Google?

转载 作者:行者123 更新时间:2023-12-02 12:15:38 25 4
gpt4 key购买 nike

我正在尝试让 google calender 正常工作,但我不确定是否需要 FIrebase 和 Google API。

我正在尝试测试这段代码`

Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials).setApplicationName("applicationName").build();
// Retrieve an event
Event event = service.events().get('primary', "eventId").execute();

System.out.println(event.getSummary());
texty = (TextView)findViewById(R.id.texty1);
Button b2 = (Button)findViewById(R.id.button2);

b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new doit().execute();

}
});

但即使我同时拥有 Firebase 和 Google API,我也无法导入所需的库。这是我的 build.gradle 文件:

    apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.ticketApp.myName.ticketApp"
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'
}
}
}


Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials).setApplicationName("applicationName").build();

// Retrieve an event
Event event = service.events().get('primary', "eventId").execute();

android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}


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'
})

//Extra dependecies


compile 'com.google.android.gms:play-services:11.2.2'

//androidTestCompile 'com.google.code.findbugs:jsr305:3.0.1'


//Google firebase
compile 'com.google.firebase:firebase-core:11.2.2'




//compile 'com.android.support:appcompat-v7:26.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'



//Jsoup för kalendern
compile 'org.jsoup:jsoup:1.10.3'

testCompile 'junit:junit:4.12'
compile 'junit:junit:4.12'

}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

有什么想法吗?它说它无法解析符号“Builder”,也无法解析方法“events”或“getSummary”。

真诚的安卓菜鸟。

最佳答案

要解决此问题,请打开 build.gradle 文件 (Module:app) 并在依赖项之前添加 Maven Central Repository,如下所示:

repositories {
mavenCentral()
}

然后更改这行代码:

compile 'com.facebook.android:facebook-android-sdk:[4,5)'

compile 'com.facebook.android:facebook-android-sdk:4.+'

关于java - 编译 Firebase 和 Google?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46197567/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com