데이터베이스를 저장하기 위해 Firebase를 사용했습니다. 하지만 응용 프로그램을 설정하는 데 오류가 발생합니다. 웹 사이트에서 새 프로젝트를 만든 다음 패키지 이름을 사용하여 구성했습니다. 또한 json 파일을 다운로드 한 다음 Project 폴더에 복사했습니다. 또한 Build.gradle 파일과 모듈 기반 gradle 파일을 변경했습니다. 다음과 같이데이터베이스를 안드로이드 앱의 외부 서버에 저장하십시오.
Build.gradle 파일은 다음과 같습니다
// 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.5.0'
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.gradle (모듈 : 응용 프로그램)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.hsports.bandpop"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.firebase:firebase-storage:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
내가 동기화 버튼을 누르면에 다음과 같은 오류를 얻고있다.
Error:Failed to resolve: com.google.firebase:firebase-core:9.6.1
<a href="openFile:C:/Users/I324671/AndroidStudioProjects/BandPop/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Error:(26, 13) Failed to resolve: com.google.firebase:firebase-storage:9.6.1
<a href="openFile:C:/Users/I324671/AndroidStudioProjects/BandPop/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
해결 방법?
여기에는 "android class"가 없습니다. 서버를 만들고 장치간에 동기화를 수행해야합니다. –