在项目Gradle同步中,发生以下错误 无法加载类“ com.annotatedsql.processor.provider.ProviderProcessor”。 导致此意外错误的可能原因包括:
我尝试重新下载依赖项并同步项目。并尝试停止并重新启动gradle。
apply plugin: 'com.android.application'
configurations {
apt
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.candroid"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFile 'proguard-project.txt'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.hamsterksu:android-annotatedsql-api:1.7.8'
// apt 'com.github.hamsterksu:android-annotatedsql-processor:1.7.8'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':vitamio')
}
android.applicationVariants.all { variant ->
def aptOutput = file("${project.buildDir}/generated/source/apt/${variant.dirName}")
variant.addJavaSourceFoldersToModel(aptOutput)
variant.javaCompile.doFirst {
aptOutput.mkdirs()
variant.javaCompile.options.compilerArgs += [
'-processorpath', configurations.apt.getAsPath(), '-processor',
'com.annotatedsql.processor.provider.ProviderProcessor,com.annotatedsql.processor.sql.SQLProcessor',
'-s', aptOutput
]
}
}