2017-01-13 3 views
0

android studio build.gradle에서 봄 부팅을 사용하는 올바른 방법은 무엇입니까? 이것은 내가android studio에서 봄 부팅

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 Apps 제작에 사용하기위한 것입니다.

그러나 Spring for Android이 있지만 사용은 REST 클라이언트 및 API 인증으로 제한됩니다.

0

다른 답변은 그가 Android 용으로 Spring을 사용한다고 가정하지만 내 답변에 포함되지 않았다고 가정합니다. 그래서 OP가하려고하는 것은 Android Studio에서 Android 앱의 백엔드 모듈을 나란히 실행하고이 모듈을 앱과 별도로 배포하려고한다고 생각합니다. 당신은

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

참고 단지 봄 부팅을위한 플러그인을 추가하는 것은 실제 봄 부팅 프레임 워크를 촉진하지 않습니다 지금은 상황이 의미가 있음을

, 여기 당신이 종속성으로 추가해야 할 것입니다 의존성에 추가해야합니다.