【发布时间】:2020-08-18 17:57:53
【问题描述】:
我正在尝试在 android 开发中导入 github,如下所示。
导入 com.github.pires.obd.commands.protocol.EchoOffCommand; 导入 com.github.pires.obd.enums.ObdProtocols;
但收到类似 Cannot resolve symbol 'github'
之类的错误消息build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://jitpack.io'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "sss.sss.obdapp"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.google.code.gson:gson:2.8.6'
//noinspection OutdatedLibrary
implementation 'com.fazecast:jSerialComm:2.0.2'
implementation 'com.android.volley:volley:1.1.0'
//noinspection GradleCompatible
}
你能帮我解决这个错误吗?
【问题讨论】:
-
在您的
build.gradle中添加implementation 'com.github.pires:obd-java-api:1.0'