Closed supermoutant closed 6 years ago
如何导入的?用的库,还是通过gradle
@kongqw 用的库
settings.gradle 文件里添加库了吗
@kongqw 添加了,我把项目删了,重回导入一次好了
我看看你app下的 gradle 文件
apply plugin: 'com.android.application'
android { compileSdkVersion 23 buildToolsVersion '26.0.2' defaultConfig { applicationId "com.kongqw.serialport" minSdkVersion 19 targetSdkVersion 23 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile project(':SerialPortLibrary') compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
}
这应该是你工程配置的问题而不是库的问题,不然不会库都找不到。 你可以尝试一下通过gradle导入
import com.kongqw.serialportlibrary.listener.OnOpenSerialPortListener; import com.kongqw.serialportlibrary.listener.OnSerialPortDataListener; import com.kongqw.serialportlibrary.Device; import com.kongqw.serialportlibrary.SerialPortManager;