1

我正在尝试使用 Robobinding 实现 MVVM 架构。这是我在 Android Studio 中为 Robobinding 的环境设置(没有 AspectJ)而关注的链接: http ://robobinding.github.io/RoboBinding/getting_started.html#_android_studio

这是添加依赖项后我的应用级别 Build.gradle 的样子:

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.example.simpletimerapp"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'

    compile "org.robobinding:robobinding:${robobindingVersion}"
}
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'
    }
}

问题是 gradle build 失败并出现以下错误:

错误:(26, 0) 在 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@2ccd2d42 上找不到属性“robobindingVersion”。打开文件

编辑1:

在用 0.8.12(robobinding 的最新版本)替换依赖块中的 ${robobindingVersion} 时,gradle build 成功完成。但是现在,我无法在布局文件的视图中使用“绑定”属性。这是错误:

为标签 TextView 找到了意外的命名空间前缀“bind”

编辑2:

仍然找不到解决方案。因此,我下载了这个最小的 android 应用程序(从他们的官方 github 页面),它实现了 robobinding 并对其进行了编辑以创建我自己的应用程序。现在工作正常。

4

0 回答 0