Dagger Hilt --Error: annotation @AggregatedRoot is missing a default value for the element 'originatingRoot'--
Dagger Hilt --Error: annotation @AggregatedRoot is missing a default value for the element 'originatingRoot'--
我在我的项目中使用 Dagger Hilt,但它没有编译。检查清单和项目文件中的所有内容,但不知道发生了什么:/
error: annotation @AggregatedRoot is missing a default value for the element 'originatingRoot'
@AggregatedRoot(
^warning: File for type 'com.example.mikebamb.EquipmentsApplication_HiltComponents' created in the last round
will not be subject to annotation processing.warning: File for type 'dagger.hilt.internal.processedrootsentinel.codegen._com_example_mikebamb_EquipmentsApplication'
created in the last round will not be subject to annotation processing.
> Task :app:kaptDebugKotlin FAILED
设备应用类
@HiltAndroidApp
class EquipmentsApplication : Application()
主要Activity
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mikebamb">
<application
android:name="com.example.mikebamb.EquipmentsApplication"
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/Theme.MikeBamb">
<activity android:name=".presenter.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
由于某些原因,我的实现版本不匹配
旧版本
implementation 'com.google.dagger:hilt-android:2.36'
kapt 'com.google.dagger:hilt-compiler:2.35.1'
回滚到
implementation 'com.google.dagger:hilt-android:2.35'
kapt 'com.google.dagger:hilt-compiler:2.35'
我在我的项目中使用 Dagger Hilt,但它没有编译。检查清单和项目文件中的所有内容,但不知道发生了什么:/
error: annotation @AggregatedRoot is missing a default value for the element 'originatingRoot'
@AggregatedRoot(
^warning: File for type 'com.example.mikebamb.EquipmentsApplication_HiltComponents' created in the last round
will not be subject to annotation processing.warning: File for type 'dagger.hilt.internal.processedrootsentinel.codegen._com_example_mikebamb_EquipmentsApplication'
created in the last round will not be subject to annotation processing.
> Task :app:kaptDebugKotlin FAILED
设备应用类
@HiltAndroidApp
class EquipmentsApplication : Application()
主要Activity
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mikebamb">
<application
android:name="com.example.mikebamb.EquipmentsApplication"
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/Theme.MikeBamb">
<activity android:name=".presenter.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
由于某些原因,我的实现版本不匹配
旧版本
implementation 'com.google.dagger:hilt-android:2.36'
kapt 'com.google.dagger:hilt-compiler:2.35.1'
回滚到
implementation 'com.google.dagger:hilt-android:2.35'
kapt 'com.google.dagger:hilt-compiler:2.35'