如何解决KaptError:Android Studio 3.0中的注释处理时出错?

时间:2017-11-13 23:48:53

标签: android kotlin dagger

大家好我在kotlin中通过dagger2-android实现了依赖注入的一些问题,在解决了所有这些问题后,我在构建应用程序时遇到了这个错误。

我使用Android Studio 3.0并且在使用匕首之前该项目运作良好,您认为我怎么能解决这个问题?或者我怎样才能获得有关错误的更多信息?因为只有"错误:screenSize"对我来说意义不大。

以防万一是AndroidManifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.sneyder.rememberconcepts">

<uses-feature
   android:name="android.hardware.location"
   android:required="false" />
<uses-feature
   android:name="android.hardware.location.gps"
   android:required="false" />
<uses-feature
   android:name="android.hardware.location.network"
   android:required="false" />
<uses-feature
   android:name="android.hardware.telephony"
   android:required="false" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" /> 

<application
    android:name=".RememberConceptsApp"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
<activity
    android:name=".ui.main.MainActivity"
    android:theme="@style/AppTheme.NoActionBar">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>
<activity
    android:name="com.amazon.device.ads.AdActivity"
    android:configChanges="keyboardHidden|orientation|screenSize" />

<activity android:name=".ui.addcard.AddCardActivity"/>

这是我得到的错误

Error message

我做了一些更改,现在看来很明显真正的错误是&#34;错误:org.jetbrains.kotlin.kapt3.diagnostic.KaptError:注释处理错误&#34;

这是我的build.gradle的样子

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-kapt'

apply plugin: 'kotlin-android-extensions'

android {
  compileSdkVersion 27
  defaultConfig {
    applicationId "com.sneyder.rememberconcepts"
    minSdkVersion 14
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}


// Define versions in a single place
ext {
  // App dependencies
  support_library_version = '27.0.0'
  constrain_layout_version = '1.0.2'
  dagger_version = '2.11'
  retrofit2_version = '2.3.0'
  gson_version = '2.8.0'
  glide_version = '4.3.1'
  rxandroid2_version = '2.0.1'
  rxjava2_version = '2.1.3'
  junit_version = '4.12'
  mockito_version = '2.7.1'
  espresso_version = "3.0.1"
  architecture_components_version = "1.0.+"
}


dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])

  // Kotlin
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

  // Support library
  implementation "com.android.support:appcompat-v7:$support_library_version"
  implementation "com.android.support:design:$support_library_version"
  implementation "com.android.support:recyclerview-v7:$support_library_version"
  implementation "com.android.support:cardview-v7:$support_library_version"
  implementation "com.android.support.constraint:constraint-layout:$constrain_layout_version"
  implementation "com.android.support:support-v4:$support_library_version"
  implementation "com.android.support:support-vector-drawable:$support_library_version"

  // Amazon ads
  implementation files('libs/amazon-ads-5.8.1.1.jar')

  // Retrofit
  implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
  implementation "com.squareup.retrofit2:converter-gson:$retrofit2_version"
  implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit2_version"

  // Architecture components
  implementation "android.arch.lifecycle:runtime:$architecture_components_version"
  implementation "android.arch.lifecycle:extensions:$architecture_components_version"
  implementation 'com.android.support.constraint:constraint-layout:1.0.2'
  kapt "android.arch.lifecycle:compiler:$architecture_components_version"
  implementation "android.arch.persistence.room:runtime:$architecture_components_version"
  kapt "android.arch.persistence.room:compiler:$architecture_components_version"
  implementation "android.arch.persistence.room:rxjava2:$architecture_components_version"

  // Gson
  implementation "com.google.code.gson:gson:$gson_version"

  // rxJava2 and rxAndroid2
  implementation "io.reactivex.rxjava2:rxjava:$rxjava2_version"
  implementation "io.reactivex.rxjava2:rxandroid:$rxandroid2_version"

  // Dagger Core
  implementation "com.google.dagger:dagger:$dagger_version"
  annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
  kapt "com.google.dagger:dagger-compiler:$dagger_version"

  // Dagger Android
  implementation "com.google.dagger:dagger-android:$dagger_version"
  implementation "com.google.dagger:dagger-android-support:$dagger_version"
  annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
  kapt "com.google.dagger:dagger-android-processor:$dagger_version"

  // Glide
  implementation "com.github.bumptech.glide:glide:$glide_version"
  annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"

  // Test dependencies
  implementation "com.android.support:support-v4:$support_library_version"
  testImplementation "junit:junit:$junit_version"
  androidTestImplementation "com.android.support.test:runner:1.0.1"
  androidTestImplementation "com.android.support.test.espresso:espresso-core:3.0.1"
}

0 个答案:

没有答案