gpt4 book ai didi

android - 如何构建和使用 Mosby 库?

转载 作者:行者123 更新时间:2023-12-03 04:47:40 25 4
gpt4 key购买 nike

我尝试添加 Mosby library到我的宠物项目,但我不明白如何将它包含到项目中?
我尝试通过添加为模块-> 添加为 Gradle 项目来添加 mosby,但它无法编译。

请给我链接一些教程,如何将项目(源代码)添加到我的项目中以及如何使用它(我的意思是从我的代码中访问库类)?

谢谢!

附言项目存储在 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'

构建.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
}

myproject\app 中的 build.gradle:
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'
}

Here is project structure

最佳答案

通过将以下内容添加到 dependencies 中,应将 Mosby 添加到您的项目中。您的 build.gradle 中的部分在 myproject\app而不是像你做的那样作为一个模块。

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链接到有关库的信息,包括有关如何使用它的教程。我在 http://hannesdorfmann.com/mosby/first-app/ 找到了示例邮件应用程序的演练。当我开始使用 Mosby 时很有帮助。

关于android - 如何构建和使用 Mosby 库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36101210/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com