对于想了解当我创建Moshi数据类时,任务':app:kaptDebugKotlin'执行失败的读者,本文将提供新的信息,并且为您提供关于androidstudio未执行代码并抛出错误,提示“任务':
对于想了解当我创建 Moshi 数据类时,任务 ':app:kaptDebugKotlin' 执行失败的读者,本文将提供新的信息,并且为您提供关于android studio 未执行代码并抛出错误,提示“任务':app:compileDebugJavaWithJavac' 执行失败”、Android Studio 构建失败“任务 ':app:kaptDebugKotlin' 的执行失败”、flutter 中的任务 ':app:stripDebugDebugSymbols' 执行失败、Flutter:任务“:app:processDebugResources”执行失败的有价值信息。
本文目录一览:- 当我创建 Moshi 数据类时,任务 ':app:kaptDebugKotlin' 执行失败
- android studio 未执行代码并抛出错误,提示“任务':app:compileDebugJavaWithJavac' 执行失败”
- Android Studio 构建失败“任务 ':app:kaptDebugKotlin' 的执行失败”
- flutter 中的任务 ':app:stripDebugDebugSymbols' 执行失败
- Flutter:任务“:app:processDebugResources”执行失败
当我创建 Moshi 数据类时,任务 ':app:kaptDebugKotlin' 执行失败
如何解决当我创建 Moshi 数据类时,任务 '':app:kaptDebugKotlin'' 执行失败
当我创建 moshi 数据类时,它没有正确构建 以下是我尝试构建时的错误
Execution Failed for task '':app:kaptDebugKotlin''.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
这是我使用 Json 到 Kotlin 插件的数据类
@JsonClass(generateAdapter = true)
data class FCMResponse(
@Json(name = "canonical_ids")
val canonicalIds: Int = 0,@Json(name = "failure")
val failure: Int = 0,@Json(name = "multicast_id")
val multicastId: Long = 0,@Json(name = "results")
val results: List<Result> = listof(),@Json(name = "success")
val success: Int = 0
)
解决方法
如果您使用的是 kotlin 1.5 版,请按如下方式更新依赖项:
- 房间到:2.3.0
- 匕首/刀柄:2.35.1
- Moshi 到:1.12.0
check this question
android studio 未执行代码并抛出错误,提示“任务':app:compileDebugJavaWithJavac' 执行失败”
如何解决android studio 未执行代码并抛出错误,提示“任务'':app:compileDebugJavaWithJavac'' 执行失败”
所以我新安装了 android studio 并尝试运行默认代码。但是我一直收到一个错误,说必须使用 JDK 而不是 JRE (Java)。进行这些更改后,我收到了这个新错误提示
ptr
请帮忙!我什至尝试卸载并重新安装工作室,但弹出相同的错误!
Android Studio 构建失败“任务 ':app:kaptDebugKotlin' 的执行失败”
如何解决Android Studio 构建失败“任务 '':app:kaptDebugKotlin'' 的执行失败”
我收到此错误,我想我明白它的来源,但我不明白问题所在。我收到的错误的详细摘要。
> Task :app:kaptDebugKotlin
C:\\Users\\matan\\AndroidStudioProjects\\RoomTut\\app\\build\\tmp\\kapt3\\stubs\\debug\\com\\example\\roomtut\\data\\MarkerDao.java:13: error: Type of the parameter must be a class annotated with @Entity or a collection/array of it.
kotlin.coroutines.Continuation<? super kotlin.Unit> p1);
^C:\\Users\\matan\\AndroidStudioProjects\\RoomTut\\app\\build\\tmp\\kapt3\\stubs\\debug\\com\\example\\roomtut\\data\\MarkerDao.java:11: error: Not sure how to handle insert method''s return type.
public abstract java.lang.Object addMarker(@org.jetbrains.annotations.NotNull()
^[WARN] Incremental annotation processing requested,but support is disabled because the following processors are not incremental: androidx.room.RoomProcessor (DYNAMIC).
> Task :app:kaptDebugKotlin Failed
FAILURE: Build Failed with an exception.
* What went wrong:
Execution Failed for task '':app:kaptDebugKotlin''.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD Failed in 32s
29 actionable tasks: 9 executed,20 up-to-date
我知道我的标记 dao 中存在问题,但对我而言,注释看起来不错,您可以在下面看到,还有指向我的完整项目的存储库的链接 - https://github.com/M-J-Y-21/room-test
import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
@Dao
interface MarkerDao {
@Insert(onConflict = OnConflictStrategy.IGnorE)
suspend fun addMarker(marker: Marker)
@Query("SELECT * FROM marker_table ORDER BY id ASC")
fun readAllData(): LiveData<List<Marker>>
}
您可以在下面看到我是如何注释标记类的
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "marker_table") data class Marker(
@PrimaryKey(autoGenerate = true)
val id: Int,val title: String,val location: String,val colour: String
)
下面是我的数据库类
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
@Database(entities = arrayOf(Marker::class),version = 1,exportSchema = false)
abstract class MarkerDatabase: RoomDatabase() {
abstract fun markerDao(): MarkerDao
companion object {
@Volatile
private var INSTANCE: MarkerDatabase? = null
fun getDatabase(context: Context): MarkerDatabase{
val tempInstance = INSTANCE
if (tempInstance != null) {
return tempInstance
}
synchronized(this) {
val instance = Room.databaseBuilder(
context.applicationContext,MarkerDatabase::class.java,"marker_database"
).build()
INSTANCE = instance
return instance
}
}
}
}
解决方法
正如我所见,您的项目使用了不同版本的 androidx.room
依赖项,例如:
"androidx.room:room-runtime:2.3.0"
"androidx.room:room-compiler:2.2.5"
您应该为所有 androidx.room
的工件使用类似的版本。 Please look at sample with more right approach:
dependencies {
...
def room_version = "2.3.0"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
kapt "androidx.room:room-compiler:$room_version"
...
}
当我将 androidx.room
的所有版本更改为 2.3.0
时,一切正常。并且不要忘记更改 addMarker
的返回类型:
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun addMarker(marker: Marker) // OK
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun addMarker(marker: Marker): Long // OK
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun addMarker(marker: Marker): Int // ERROR
我是如何寻找问题的:
- 检查
@Insert
方法的返回类型(见上文)。 - 检查参数的类型和插入方法的注释(
@Entity
)。 - 检查导入:IDE 可以自动添加名称相似但来自其他包的导入类或注解。
- Check setup of database。
- Check project dependencies(or other doc''s sample)。
附言您通过 MarkerDatabase.Companion.getDatabase()
实现的单例是错误的 :( 请使用双重检查锁定算法,或将所有方法设为同步或尝试根据您的情况调整 kotlin 的 lazy
。
flutter 中的任务 ':app:stripDebugDebugSymbols' 执行失败
如何解决flutter 中的任务 '':app:stripDebugDebugSymbols'' 执行失败
当我尝试在设备上运行我的 Flutter 应用程序时,我的构建未能给出此错误
> Execution Failed for task '':app:stripDebugDebugSymbols''.
> NDK at C:\\Users\\User\\AppData\\Local\\Android\\sdk\\ndk-bundle did not have a source.properties file
我已尝试通过 [this][1] 解决此问题。但它没有用。 我有 ndk 版本 23.0.7421159rc5 已安装。 这是颤振医生的结果
>[√] Flutter (Channel stable,2.0.5,on Microsoft Windows [Version 10.0.19042.985],locale en-US)<br>
>[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)<br>
>[√] Chrome - develop for the web<br>
>[!] Android Studio (version 4.0)<br>
X Unable to find bundled Java version.<br>
>[√] Android Studio (version 4.1.0)<br>
[√] VS Code (version 1.57.1)<br>
[√] Connected device (3 available)
请帮忙解决问题
https://github.com/facebook/react-native/issues/28404
解决方法
进入您的 SDK
位置并找到名为 ndk 的目录,然后删除该目录中的内容。然后再次构建应用程序。可能 ndk 版本已损坏,Android Studio 会将其替换为最新版本。
Flutter:任务“:app:processDebugResources”执行失败
如何解决Flutter:任务“:app:processDebugResources”执行失败
当我尝试在 Android 上构建我的 Flutter 应用程序时收到此错误消息。自从我几天前开始这个项目以来,它运行良好。在 IOS 模拟器上做了一些测试后,我不得不再次在 Android 上尝试一些东西,但无法再构建它。
Launching lib/main.dart on AOSP on IA Emulator in debug mode...
FAILURE: Build Failed with an exception.
* What went wrong:
Execution Failed for task '':app:processDebugResources''.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking Failed
ERROR:/Users/Antonio/DropBox/Flutter/wader/build/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:22: AAPT: error: ''orientation|keyboardHidden|keyboard|viewsize|smallestviewsize|locale|layoutDirection|fontScale|screenLayout|density|uiMode'' is incompatible with attribute configChanges (attr) flags [colorMode=16384,density=4096,fontScale=1073741824,keyboard=16,keyboardHidden=32,layoutDirection=8192,locale=4,mcc=1,mnc=2,navigation=64,orientation=128,screenLayout=256,screenSize=1024,smallestScreenSize=2048,touchscreen=8,uiMode=512].
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD Failed in 1m 40s
The build Failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility.
Building plugin connectivity...
FAILURE: Build Failed with an exception.
* What went wrong:
Task ''assembleAarRelease'' not found in root project ''connectivity''.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD Failed in 4s
Exception: The plugin connectivity Could not be built due to the issue above.
Exited (sigterm)
这是我的颤振医生:
Doctor summary (to see all details,run Flutter doctor -v):
[✓] Flutter (Channel stable,2.2.2,on Mac OS X 10.15.7 19H1030 darwin-x64,locale en-AE)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.44.0)
[✓] VS Code (version 1.43.2)
[✓] Connected device (2 available)
• No issues found!
有什么想法吗?
我们今天的关于当我创建 Moshi 数据类时,任务 ':app:kaptDebugKotlin' 执行失败的分享已经告一段落,感谢您的关注,如果您想了解更多关于android studio 未执行代码并抛出错误,提示“任务':app:compileDebugJavaWithJavac' 执行失败”、Android Studio 构建失败“任务 ':app:kaptDebugKotlin' 的执行失败”、flutter 中的任务 ':app:stripDebugDebugSymbols' 执行失败、Flutter:任务“:app:processDebugResources”执行失败的相关信息,请在本站查询。
本文标签: