如何构建和使用 Mosby 库?
How to build and use Mosby library?
我尝试将 Mosby library 添加到我的宠物项目中,但我不明白如何将其添加到项目中?
我尝试通过添加为模块-> 添加为 Gradle 项目来添加 mosby,但它无法编译。
拜托,你能 link 给我一些教程如何将项目(源)添加到我的项目中以及如何使用它吗(我的意思是从我的代码访问库 类)?
谢谢!
P.S。项目存储在 K:\PetProject。莫斯比位于:K:\mosby.
settings.gradle(我的项目):
include ':app', ':mvp', ':sample-dagger2-rx', ':sample', ':mvp-common', ':viewstate', ':sample-kotlin', ':sample-flow', ':testing', ':sample-mail', ':sample-dagger1'
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:2.0.0-beta7'
// 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 在 myproject\app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "net.simplevolk.mafiagm"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/java/2'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
}
应将 Mosby 添加到您的项目中,方法是将以下内容添加到 build.gradle
的 myproject\app
中的 dependencies
部分,而不是像您那样作为一个模块。
compile 'com.hannesdorfmann.mosby:mvp:2.0.1'
compile 'com.hannesdorfmann.mosby:viewstate:2.0.1' // optional viewstate feature
关于使用 Mosby 的教程,url at the top of the Mosby github page links to information about the library including a tutorial about how to use it. I found the walk through of the sample-mail app at http://hannesdorfmann.com/mosby/first-app/ 在我开始使用 Mosby 时很有帮助。
我尝试将 Mosby library 添加到我的宠物项目中,但我不明白如何将其添加到项目中? 我尝试通过添加为模块-> 添加为 Gradle 项目来添加 mosby,但它无法编译。
拜托,你能 link 给我一些教程如何将项目(源)添加到我的项目中以及如何使用它吗(我的意思是从我的代码访问库 类)?
谢谢!
P.S。项目存储在 K:\PetProject。莫斯比位于:K:\mosby.
settings.gradle(我的项目):
include ':app', ':mvp', ':sample-dagger2-rx', ':sample', ':mvp-common', ':viewstate', ':sample-kotlin', ':sample-flow', ':testing', ':sample-mail', ':sample-dagger1'
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:2.0.0-beta7'
// 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 在 myproject\app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "net.simplevolk.mafiagm"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/java/2'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
}
应将 Mosby 添加到您的项目中,方法是将以下内容添加到 build.gradle
的 myproject\app
中的 dependencies
部分,而不是像您那样作为一个模块。
compile 'com.hannesdorfmann.mosby:mvp:2.0.1'
compile 'com.hannesdorfmann.mosby:viewstate:2.0.1' // optional viewstate feature
关于使用 Mosby 的教程,url at the top of the Mosby github page links to information about the library including a tutorial about how to use it. I found the walk through of the sample-mail app at http://hannesdorfmann.com/mosby/first-app/ 在我开始使用 Mosby 时很有帮助。