1.添加内容
1.1.build.gradle(project)
添加内容
buildscript {
ext.objectboxVersion = "3.4.0"
repositories {
mavenCentral()
// Note: 2.9.0 and older are available on jcenter()
}
dependencies {
// Android Gradle Plugin 3.3.0 or later supported.
classpath("com.android.tools.build:gradle:7.2.2")
classpath("io.objectbox:objectbox-gradle-plugin:$objectboxVersion")
}
}
添加后显示如下
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.objectboxVersion = "3.4.0"
repositories {
mavenCentral()
// Note: 2.9.0 and older are available on jcenter()
}
dependencies {
// Android Gradle Plugin 3.3.0 or later supported.
classpath("com.android.tools.build:gradle:7.2.2")
classpath("io.objectbox:objectbox-gradle-plugin:$objectboxVersion")
}
}
plugins {
id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}
1.2.build.gradle(Module)
添加内容
plugins {
id 'io.objectbox' // Apply last.
}
添加后显示内容
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'io.objectbox' // Apply last.
}
android {
namespace 'com.example.button01'
compileSdk 32
defaultConfig {
applicationId "com.example.button01"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0-alpha02'
implementation 'androidx.appcompat:appcompat:1.7.0-alpha01'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}