2016-10-20 4 views
-1

데이터베이스를 저장하기 위해 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> 

해결 방법?

+1

여기에는 "android class"가 없습니다. 서버를 만들고 장치간에 동기화를 수행해야합니다. –

답변

1

여기에는 Android 클래스가 없습니다. 대신, 당신이 그것을 달성하는 데 도움이되는 자신의 서버/API를 만들 수도 있고, 클라이언트 데이터를 쉽게 동기화/저장하는 데 도움이되는 제 3 자 서비스를 사용할 수도 있습니다. Firebase을 사용하는 것이 좋습니다. 사용하기 쉽고 플랫폼을 넘어서 쉽습니다.

+0

질문을 변경했습니다. Firebase를 사용하여 데이터베이스를 구성했습니다. 그리고 동기화하는 동안 몇 가지 오류가 발생합니다. 이걸 도와주세요. –

관련 문제