2017-01-13 5 views
0

android studio build.gradleでスプリングブートを使用する正しい方法は何ですか? これは私がusing-午前何アンドロイドスタジオのスプリングブート

apply plugin: 'com.android.application' 
buildscript { 
repositories { 
    mavenCentral() 
    mavenLocal() 
    jcenter() 
} 
dependencies { 
    classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.3.RELEASE") 
} 
} 
android { 
compileSdkVersion 24 
buildToolsVersion "24.0.1" 
defaultConfig { 
    applicationId "com.example.prateek.businesscardrest" 
    minSdkVersion 15 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
packagingOptions { 
    exclude 'META-INF/DEPENDENCIES.txt' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/notice.txt' 
    exclude 'META-INF/license.txt' 
    exclude 'META-INF/dependencies.txt' 
    exclude 'META-INF/LGPL2.1' 
    exclude 'META-INF/spring.schemas' 
    exclude 'META-INF/spring.tooling' 
    exclude 'META-INF/INDEX.LIST' 
    exclude 'META-INF/spring.handlers' 
} 
configurations { 
    all*.exclude module: 'classworlds' 
    all*.exclude module: 'commons-logging' 
    all*.exclude module: 'httpclient' 
    all*.exclude module: 'maven-artifact' 
    all*.exclude module: 'maven-artifact-manager' 
    all*.exclude module: 'maven-error-diagnostics' 
    all*.exclude module: 'maven-model' 
    all*.exclude module: 'maven-project' 
    all*.exclude module: 'maven-settings' 
    all*.exclude module: 'plexus-container-default' 
    all*.exclude module: 'plexus-interpolation' 
    all*.exclude module: 'plexus-utils' 
    all*.exclude module: 'wagon-file' 
    all*.exclude module: 'wagon-http-lightweight' 
    all*.exclude module: 'wagon-provider-api' 

} 
} 
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' 
}) 
compile 'com.android.support:appcompat-v7:25.1.0' 
compile 'com.android.support:design:25.1.0' 
compile 'com.android.support:support-v4:25.1.0' 
compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3' 
compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2' 
compile 'org.springframework:spring-web:3.1.1.RELEASE' 
compile 'com.google.code.findbugs:jsr305:2.0.1' 
testCompile 'junit:junit:4.12' 
// tag::jetty[] 
compile("org.springframework.boot:spring-boot-starter-web") { 
    exclude module: "spring-boot-starter-tomcat" 
} 

} 

である。しかし、これはエラー - エラーを生成します。解決に失敗しました:org.springframework.boot:春・ブート・スターター・ウェブ

答えて

0

春ブーツはではありませんは、Androidアプリケーションの制作に使用するためのもので、Webアプリケーションの構築に最適でした。

しかし、Spring for Androidが存在しますが、使用はRESTクライアント認証とAPI認証に限定されています。

0

もう1つの答えは、彼がAndroid用にSpringを使用していると仮定していますが、私は彼が私の答えにないと思います。だから私は、OPがやっていることは、AndroidスタジオのAndroid Appのバックエンドモジュールを横に並べて実行し、このモジュールをAppとは別に展開したいと考えています。あなたは、

dependencies { 
    compile("org.springframework.boot:spring-boot-starter-web:1.5.3.RELEASE") 
} 

注ちょうど春ブート用のプラグインを追加することで、実際の春のブートフレームワークを促進していません。今、物事は理にかなっていること

は、ここにあなたが依存関係として追加するために必要なものです依存関係に追加する必要があります。

関連する問題