按照官网给出的配置步骤
在项目中的build.gradle中添加
buildscript
{
ext
.
objectboxVersion
=
'1.3.3'
repositories
{
jcenter
(
)
maven
{
url
"http://objectbox.net/beta-repo/"
}
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.3.3'
classpath
"io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
}
}
apply
plugin
:
'com.android.application'
apply
plugin
:
'io.objectbox'
3
4
5
6
7
8
9
10
11
|
dependencies
{
// all below should be added automatically by the plugin
compile
"io.objectbox:objectbox-android:$objectboxVersion"
// some useful Kotlin extension functions
// compile "io.objectbox:objectbox-kotlin:$objectboxVersion"
annotationProcessor
"io.objectbox:objectbox-processor:$objectboxVersion"
// When using Kotlin use kapt instead:
// kapt "io.objectbox:objectbox-processor:$objectboxVersion"
}
|
但如果你想在调试的时候在浏览器中查看数据库,按照官网的步骤
在原来依赖的基础上直接加入
|
|
dependencies
{
debugCompile
"io.objectbox:objectbox-android-objectbrowser:$objectboxVersion"
releaseCompile
"io.objectbox:objectbox-android:$objectboxVersion"
}
编译的时候就会报 jar包 冲突的错误
我们可以这样解决
|
buildscript
{
ext
.
objectboxVersion
=
'1.3.3'
repositories
{
jcenter
(
)
maven
{
url
"http://objectbox.net/beta-repo/"
}
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.3.3'
//
classpath
"io.objectbox:objectbox-gradle-plugin:$objectboxVersion"(注释掉)
}
}
//apply plugin : 'io.objectbox'(注释掉)
然后在你的Application中配置以下内容 即可
|