2017-01-17 14 views
0

私はこのチュートリアルを使って、Restful Web Serviceを構築しようとしています:https://spring.io/guides/gs/rest-service/。しかし、私はこの時代に立ち往生した。Springブートアプリケーションはorg.springframework.boot.SpringApplicationを解決できませんか?

は、私はまた、ビルドのGradle

Error:(26, 0) Cannot change configuration ':app:classpath' after it has been resolved.

それはこのようになります。(私は私のAndroidアプリでのRESTful Webサービスを作成しようとしているので、私はいくつかの余分な依存関係を持っている)でいくつかの問題を持っています。

`apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 22 
    buildToolsVersion "22.0.1" 

    defaultConfig { 
     applicationId "com.sample.foo.simplelocationapp" 
     minSdkVersion 15 
     targetSdkVersion 22 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

    buildscript { 
     repositories { 
      mavenCentral() 
     } 
     dependencies { 
      classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.3.RELEASE") 

     } 
    } 
    plugins { 
     id "org.springframework.boot" version "1.4.3.RELEASE" 
    } 

    subprojects { 
     apply plugin: 'java' 
     apply plugin: 'eclipse' 
     apply plugin: 'spring-boot' 
     apply plugin: 'org.springframework.boot' 
     apply plugin: 'idea' 
    } 



    jar { 
     baseName = 'gs-spring-boot' 
     version = '0.1.0' 
    } 

    repositories { 
     mavenCentral() 
    } 

    sourceCompatibility = 1.8 
    targetCompatibility = 1.8 


    packagingOptions { 
     exclude 'META-INF/ASL2.0' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/notice.txt' 
    } 

} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:22.2.0' 
    compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE' 
    compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2' 
    compile 'com.android.databinding:compiler:1.0-rc0' 
    compile 'org.springframework:spring-web:4.2.1.RELEASE' 
    compile("org.springframework.boot:spring-boot-starter-web") { 
     exclude module: "spring-boot-starter-tomcat" 
    } 
    compile("org.springframework.boot:spring-boot-starter-jetty") 
    // end::jetty[] 
    // tag::actuator[] 
    compile("org.springframework.boot:spring-boot-starter-actuator") 
    // end::actuator[] 
    testCompile("junit:junit") 
} 

`

誰かが私を助けてくださいことはできますか?

答えて

0

あなたのAndroidアプリには、頼りになるWebサービスを入れることができないという点がポイントです。 Androidアプリケーションはクライアントであり、サーバー(熟練したWebサービスプロバイダー)によって提供される情報を消費します。

enter image description here

クライアント(緑色のボックス)は、あなたのAndroidアプリです。サーバー(青色のボックス)はスプリングブートアプリケーションです。

https://spring.io/guides/gs/rest-service/をそのままダウンロードして実行することをお勧めします。いくつかのシンプルなJsonを公開し、ブラウザからブラウザにいくつかの呼び出しを試みることができます。

露出リソースは、ポート8080で実行されていると、次のとおりです。?ローカルネットワーク上の

  • /挨拶
  • /挨拶名= myValue

作業のIPを見つけますあなたがサーバーを実行しているコンピュータで、あなたのAndroidアプリからこのリソースを消費しようとします。

希望するもの:D

+0

ありがとうございました!私は今何が間違っているのかを見ることができます。 –

+0

なので、クライアント(アンドロイドアプリ)から緯度経度の場所を、すでにJavaで作成したサーバーに送信し、その日付をデータベースに保存したいと考えています。その後、地図上にhtmlで作成したモニタに追加された場所を表示します。あなたは私にそれをする手がかりを与えることができますか?ありがとうございました ! –

+0

ええと、すでに情報をデータベースに保存しているので、次はその位置を表示します。あなたがAngularJSを知っていれば、それを使うことができます。 AngledJSアプリを埋め込んだコントローラ(SpringMVC)を定義することができます(Googleマップ)。あなたがそれを使うのを助ける多くのAngularライブラリがあります! – Nano

関連する問題