晕死,搞这个东西搞了一天 记录一下逝去的时间。
最最最主要的问题就是:里面的包依赖,SDK互相对应等
解决:首先决定自己要使用SDK版本
apply plugin: 'com.android.application'
android {
compileSdkVersion 28//这个
buildToolsVersion '28.0.1' //这个
defaultConfig {
applicationId "com.example.bluetoothassist"
minSdkVersion 16
targetSdkVersion 28//这个
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:cardview-v7:28.+'//这个
implementation 'com.android.support:support-v4:28.0.0'//这个
implementation 'com.android.support:support-v13:28.0.0'//这个
implementation 'com.android.support:appcompat-v7:28.0.0'//这个
implementation 'com.makeramen:roundedimageview:2.3.0'//这个
}
dependencies 里面的那些依赖如果提示没有的话在下面地方进行查找添加
以上标记这个的弄一样的版本是最好的
可以在你的Android Studio这个目录看你拥有的
classpath
// 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:3.3.2'//跟你目录上门有的要选择一个保持一致
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
//maven { url "https://maven.google.com"}
//maven { url "https://dl.google.com/dl/android/maven2/"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是几个最重要的点 其他还有有的时候包没找到依然通过上面的那个寻找进行查找添加,
进行真机调试时解析包错误