KaptContext cannot access Context - android

I want to integrate fastlane into my project. I have set up all the basic stuff and now I want to deploy my project to beta release. I run fastlane android beta and get below error.
If I compile with Android Studio 3.1 everything works fine.
:app:kaptGenerateStubsReleaseKotline: java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.KaptContext (in unnamed module #0x253fbddb) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module #0x253fbddb
at org.jetbrains.kotlin.kapt3.KaptContext.<init>(KaptContext.kt:47)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.compileStubs(Kapt3Extension.kt:265)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.generateStubs(Kapt3Extension.kt:215)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:178)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:93)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:97)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:84)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:374)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:64)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:101)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:365)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:130)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:161)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:63)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:108)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:52)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:451)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:97)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:218)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:80)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:92)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.execIncrementalCompiler(CompileServiceImpl.kt:527)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execIncrementalCompiler(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:408)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:909)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:939)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:908)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:407)
at sun.reflect.NativeMethodAccessorImpl.invoke0(java.base#9-internal/Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(java.base#9-internal/NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(java.base#9-internal/DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(java.base#9-internal/Method.java:531)
at sun.rmi.server.UnicastServerRef.dispatch(java.rmi#9-internal/UnicastServerRef.java:321)
at sun.rmi.transport.Transport$1.run(java.rmi#9-internal/Transport.java:200)
at sun.rmi.transport.Transport$1.run(java.rmi#9-internal/Transport.java:197)
at java.security.AccessController.doPrivileged(java.base#9-internal/Native Method)
at sun.rmi.transport.Transport.serviceCall(java.rmi#9-internal/Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(java.rmi#9-internal/TCPTransport.java:563)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(java.rmi#9-internal/TCPTransport.java:821)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(java.rmi#9-internal/TCPTransport.java:678)
at java.security.AccessController.doPrivileged(java.base#9-internal/Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(java.rmi#9-internal/TCPTransport.java:677)
at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base#9-internal/ThreadPoolExecutor.java:1158)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base#9-internal/ThreadPoolExecutor.java:632)
at java.lang.Thread.run(java.base#9-internal/Thread.java:804)
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptGenerateStubsReleaseKotlin'.
> Internal compiler error. See log for more details
Gradle Dependencies
ext.kotlin_version = '1.2.31'
ext.daggerVersion = '2.7'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
implementation "com.google.dagger:dagger:$daggerVersion"
Any idea what might be wrong here?

when I have updated Gradle this nothing-saying error changed to proper one - the issue was that Google database Room dependency hadn't had proper cerificate and I needed to change openjdk9 to openjdk8 (I am using Ubuntu), then error disappeared

Related

ktLintFormat fails with an error: Process 'command '/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/java'' (macOS w/ Apple M1 chip)

Installed ktLint on my Android Studio project but when running I get the following error:
Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at com.pinterest.ktlint.KtlintCommandLine.parallel(Main.kt:576)
at com.pinterest.ktlint.KtlintCommandLine.parallel$default(Main.kt:548)
at com.pinterest.ktlint.KtlintCommandLine.lintFiles(Main.kt:298)
at com.pinterest.ktlint.KtlintCommandLine.run(Main.kt:262)
at com.pinterest.ktlint.Main.main(Main.kt:70)
Caused by: java.lang.ExceptionInInitializerError
at org.jetbrains.kotlin.com.intellij.util.exception.FrequentErrorLogger.report(FrequentErrorLogger.java:46)
at org.jetbrains.kotlin.com.intellij.util.exception.FrequentErrorLogger.info(FrequentErrorLogger.java:42)
at org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil.handleUnspecifiedTrace(DebugUtil.java:626)
at org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil.currentInvalidationTrace(DebugUtil.java:618)
at org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil.calcInvalidationTrace(DebugUtil.java:612)
at org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil.onInvalidated(DebugUtil.java:583)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeElement.onInvalidated(TreeElement.java:226)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeElement.rawRemoveUpToWithoutNotifications(TreeElement.java:388)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeElement.rawRemoveUpTo(TreeElement.java:342)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.CompositeElement.remove(CompositeElement.java:775)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.CompositeElement.lambda$removeChildrenInner$4(CompositeElement.java:797)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.ChangeUtil$1.runInner(ChangeUtil.java:149)
at org.jetbrains.kotlin.com.intellij.pom.impl.PomTransactionBase.run(PomTransactionBase.java:46)
at com.pinterest.ktlint.core.internal.FormatPomModel.runTransaction(KotlinPsiFileFactory.kt:121)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.ChangeUtil.prepareAndRunChangeAction(ChangeUtil.java:143)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.CompositeElement.removeChildrenInner(CompositeElement.java:796)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.CompositeElement.replaceChild(CompositeElement.java:623)
at org.jetbrains.kotlin.com.intellij.psi.impl.source.codeStyle.CodeEditUtil.replaceChild(CodeEditUtil.java:162)
at org.jetbrains.kotlin.com.intellij.extapi.psi.ASTDelegatePsiElement.replaceChildInternal(ASTDelegatePsiElement.java:385)
at org.jetbrains.kotlin.com.intellij.extapi.psi.ASTDelegatePsiElement.replace(ASTDelegatePsiElement.java:375)
at org.jetbrains.kotlin.psi.KtExpressionImplStub.rawReplace(KtExpressionImplStub.java:48)
at org.jetbrains.kotlin.psi.KtExpressionImpl$Companion.replaceExpression(KtExpressionImpl.kt:53)
at org.jetbrains.kotlin.psi.KtExpressionImplStub.replace(KtExpressionImplStub.java:43)
at com.pinterest.ktlint.ruleset.standard.StringTemplateRule.visit(StringTemplateRule.kt:49)
at com.pinterest.ktlint.core.KtLint$format$1.invoke(KtLint.kt:389)
at com.pinterest.ktlint.core.KtLint$format$1.invoke(KtLint.kt:382)
at com.pinterest.ktlint.core.KtLint$visitor$2$2.invoke(KtLint.kt:313)
at com.pinterest.ktlint.core.KtLint$visitor$2$2.invoke(KtLint.kt:312)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:229)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:230)
at com.pinterest.ktlint.core.KtLint$visitor$2.invoke(KtLint.kt:312)
at com.pinterest.ktlint.core.KtLint$visitor$2.invoke(KtLint.kt:300)
at com.pinterest.ktlint.core.KtLint.format(KtLint.kt:382)
at com.pinterest.ktlint.internal.FileUtilsKt.formatFile(FileUtils.kt:202)
at com.pinterest.ktlint.KtlintCommandLine.process(Main.kt:366)
at com.pinterest.ktlint.KtlintCommandLine.access$process(Main.kt:89)
at com.pinterest.ktlint.KtlintCommandLine$lintFiles$3.invoke$lambda-0(Main.kt:289)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private transient java.lang.Object java.lang.Throwable.backtrace accessible: module java.base does not "opens java.lang" to unnamed module #fe48b45
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.findFieldInHierarchy(ReflectionUtil.java:153)
at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.getDeclaredField(ReflectionUtil.java:278)
at org.jetbrains.kotlin.com.intellij.openapi.util.objectTree.ThrowableInterner.<clinit>(ThrowableInterner.java:81)
... 50 more
> Task :app:ktlintFormat FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:ktlintFormat'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
I'v found some places talking about a wrong version of Java installed to satisfy ktLint, but it's from last year and I'mm already using a newer version of Java the what was suggested. F.eks. this thread:
https://githubmemory.com/repo/pinterest/ktlint/issues/1227
Here is my ktLint.gradle file which is quite standard:
configurations {
ktlint
}
dependencies {
ktlint "com.pinterest:ktlint:0.43.2"
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
ignoreExitValue = true
// create html report for CI and plain report for terminal report
args "--android", "--color", "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/reports/ktlint-results.xml", "src/**/*.kt"
}
task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "-F", "src/**/*.kt"
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
}
And the Java version:
java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
Hardware:
macOS Monterey 12.0.1
Apple M1 chip
Gradle 7.3.3
Configure your ktlintFormat task to include jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED"), works for me with with JDK 17.0.1.
Source: https://github.com/pinterest/ktlint/issues/1195

Resource linking fails on lStar with error

I'm working on a android Native application. My Android builds began to fail without any changes.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':etndoorcontrol:processHesuan_faceDebugResources'.
> Android resource linking failed
C:\Users\xqf\.gradle\caches\transforms-2\files-2.1\fe7b90aa462d9a2e04dd8216aa450a51\res\values\values.xml:2422:5-2449:25: AAPT: error: resource android:attr/lStar not found.
error: failed linking references.
Then I tried 2 solutions
//soultion 1.
configurations.all {
resolutionStrategy {
// Java language implementation
force "androidx.core:core:1.6.0"
// Kotlin
force "androidx.core:core-ktx:1.6.0"
}
}
After I add this to app/build.gradle, the app can build correct.but after I install the apk and run .there is a new problem.
java stacktrace:
java.lang.NoClassDefFoundError: androidx.appcompat.widget.Toolbar
at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
at java.lang.Class.getDexCacheType(Class.java:2551)
at java.lang.reflect.AbstractMethod.getParameterTypes(AbstractMethod.java:169)
at java.lang.reflect.Method.getParameterTypes(Method.java:193)
at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingReflectionInSingleClass(SubscriberMethodFinder.java:163)
at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingInfo(SubscriberMethodFinder.java:88)
at org.greenrobot.eventbus.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:64)
at org.greenrobot.eventbus.EventBus.register(EventBus.java:140)
at com.yarward.a10doorcontrol.homepage.HomePageActivity.initFields(HomePageActivity.java:334)
at com.yarward.base.mvp.view.BaseActivity.onCreate(BaseActivity.java:82)
at com.yarward.a10doorcontrol.homepage.HomePageActivity.onCreate(HomePageActivity.java:257)
at android.app.Activity.performCreate(Activity.java:6709)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2628)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2736)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1487)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6157)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
Caused by: java.lang.ClassNotFoundException: androidx.appcompat.widget.Toolbar
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at libcore.reflect.InternalNames.getClass(InternalNames.java:53)
... 22 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/view/MenuHost;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at libcore.reflect.InternalNames.getClass(InternalNames.java:53)
at java.lang.Class.getDexCacheType(Class.java:2551)
at java.lang.reflect.AbstractMethod.getParameterTypes(AbstractMethod.java:169)
at java.lang.reflect.Method.getParameterTypes(Method.java:193)
at java.lang.Class.getDeclaredMethods(Class.java:1812)
at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingReflectionInSingleClass(SubscriberMethodFinder.java:154)
... 18 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.view.MenuHost" on path: DexPathList[[zip file "/data/app/com.yarward.hesuanface-1/base.apk"],nativeLibraryDirectories=[/data/app/com.yarward.hesuanface-1/lib/arm, /data/app/com.yarward.hesuanface-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 28 more
After this, I tried the other solution, as below:
ext{
androidX = 1.6.0
}
but this is not working for me.
axel8888 thank your sir, yes, I have solved this problem. yes, you are right , when I try solution one again
configurations.all {
resolutionStrategy {
// Java language implementation
force "androidx.core:core:1.6.0"
// Kotlin
force "androidx.core:core-ktx:1.6.0"
}
}
and as you the problem is now in
androidx.appcompat:appcompat:1.4.0-alpha
so I checked the gradle dependencies, yes , even I used
androidx.appcompat:appcompat:1.3.1
but my project shows the version is 1.4.0-alpha. here is my solution
configurations.all {
resolutionStrategy.eachDependency { details ->
def requested = details.requested
if (requested.group == "androidx.appcompat") {
if (requested.name == "appcompat") {
details.useVersion "1.3.1"
}
}
}
}
and it worked, now my project can build and run correctly, thank you, sir!
Obveiously the problem is now in androidx.appcompat:appcompat:1.4.0-alpha. If your UI use Toolbar, you will get the MenuHost not found crash.BUT, evenif I use resolutionStrategy to force 'androidx.appcompat:appcompat:1.3.1', dependency still make it toandroidx.appcompat:appcompat:{strictly 1.4.0-beta01}
It still confuse me a lot.
SOLVED -- someone write a update code for appcompat before... now it can force to 1.3.1 and solve the problem
change
implementation 'androidx.appcompat:appcompat:1.4.0'
to
implementation 'androidx.appcompat:appcompat:1.3.1'
that's it
implementation 'androidx.appcompat:appcompat:1.4.1'
was causing the problem, going back to 1.3.1 worked.
implementation 'androidx.appcompat:appcompat:1.3.1'
ill update once I get an official solution.

Room database is not working in mac book pro m1

Room database is not working in mac book pro m1
i have already added id 'kotlin-kapt'
screen shoot of android studio console log
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)
Caused by: java.lang.reflect.InvocationTargetException at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at
org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:90)
at
org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:31)
at org.jetbrains.kotlin.kapt3.base.Kapt.kapt(Kapt.kt:45) ... 31 more
Caused by: java.lang.Exception: No native library is found for
os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64
at
org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:333)
at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:64)
at
androidx.room.verifier.DatabaseVerifier.(DatabaseVerifier.kt:71)
... 50 more
Simply use Room 2.4.0-alpha03
def room_version = "2.4.0-alpha03"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
Edit : The answer consisted of two solutions to solve the issue , since the above written solution was successful for many ,the other solution is removed .
add dependency:
kapt "org.xerial:sqlite-jdbc:3.34.0"

Problems getting started with Chirp SDKs for Android

I have downloaded SDK for Android from
https://developers.chirp.io/downloads
After that I added *.aar library as was explain here:
https://developer.android.com/studio/projects/android-library.html#AddDependency
Hurrah. I can build the project.
Now I want to install the test App on the phone. But the application crashes like this:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.chirp.sdkdemoapp, PID: 12979
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
at io.chirp.chirpsdk.ChirpSDK.<init>(Unknown Source:2)
at io.chirp.chirpsdk.ChirpSDK.<init>(Unknown Source:5)
at io.chirp.chirpsdk.ChirpSDK.<init>(Unknown Source:8)
at io.chirp.sdkdemoapp.MainActivity.onCreate(MainActivity.java:77)
As I understand it, a problem arose with dependencies when packaging * aar
So I added in build.gradle (marked as Module) dependency for kotlin like:
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.2.61'
After that my ERROR has changed.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.chirp.sdkdemoapp, PID: 13395
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/MediaType;
at io.chirp.b.a.<init>(Unknown Source:24)
at io.chirp.chirpsdk.a.<init>(Unknown Source:36)
at io.chirp.chirpsdk.ChirpSDK.<init>(Unknown Source:20)
at io.chirp.chirpsdk.ChirpSDK.<init>(Unknown Source:5)
at io.chirp.chirpsdk.ChirpSDK.<init>(Unknown Source:8)
at io.chirp.sdkdemoapp.MainActivity.onCreate(MainActivity.java:77)
I have wrong paths to io.chirp internal libraries.
What should I do to resolve dependency related errors?
You have to import the okhttp 3.12.x dependency required by the ChirpSDK.
However, you don't need to explicitly import the dependency if you are using the SDK from the maven repository as this will be already included:
implementation 'io.chirp:chirpsdk:3.10.0'
and add the repository in your parent maven file:
repositories {
maven {
url "https://maven.chirp.io/release"
}
}
Thanks Dinu for your answer!
Maven repository doesn't work in my case (proxy issues or something else but this is the topic of another discussion).
The problem with using offline ChirpSDK was solved by adding two dependencies:
implementation 'com.squareup.okhttp3:okhttp:3.12.6'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.50'

Android Gradle - Assertion Error

When I try to do a Gradle Sync, I get an error that says the following:
21:24:11 AssertionError:
com.android.tools.idea.gradle.project.AndroidGradleProjectComponent#8e8dc05
22:13:53 AssertionError: null
And when I view the error in detail, I get this Stack Trace:
null java.lang.AssertionError at
com.android.tools.idea.gradle.project.PreSyncChecks.attemptToUpdateGradleVersionInWrapper(PreSyncChecks.java:174)
at
com.android.tools.idea.gradle.project.PreSyncChecks.ensureCorrectGradleSettings(PreSyncChecks.java:72)
at
com.android.tools.idea.gradle.project.PreSyncChecks.canSync(PreSyncChecks.java:53)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.doImport(GradleProjectImporter.java:430)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.doRequestSync(GradleProjectImporter.java:219)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.access$000(GradleProjectImporter.java:77)
at
com.android.tools.idea.gradle.project.GradleProjectImporter$2.run(GradleProjectImporter.java:184)
at
com.intellij.ui.AppUIUtil.invokeLaterIfProjectAlive(AppUIUtil.java:77)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.requestProjectSync(GradleProjectImporter.java:191)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.requestProjectSync(GradleProjectImporter.java:166)
at
com.android.tools.idea.gradle.actions.SyncProjectAction.actionPerformed(SyncProjectAction.java:43)
at
com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:164)
at
com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:170)
at
com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:133)
at
com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:313)
at java.awt.Component.processEvent(Component.java:6179) at
java.awt.Container.processEvent(Container.java:2084) at
java.awt.Component.dispatchEventImpl(Component.java:4776) at
java.awt.Container.dispatchEventImpl(Container.java:2142) at
java.awt.Component.dispatchEvent(Component.java:4604) at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4279)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4209)
at java.awt.Container.dispatchEventImpl(Container.java:2128) at
java.awt.Window.dispatchEventImpl(Window.java:2492) at
java.awt.Component.dispatchEvent(Component.java:4604) at
java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717) at
java.awt.EventQueue.access$400(EventQueue.java:82) at
java.awt.EventQueue$2.run(EventQueue.java:676) at
java.awt.EventQueue$2.run(EventQueue.java:674) at
java.security.AccessController.doPrivileged(Native Method) at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:690) at
java.awt.EventQueue$3.run(EventQueue.java:688) at
java.security.AccessController.doPrivileged(Native Method) at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:687) at
com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:697)
at
com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:520)
at
com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Any idea how I can fix this?
If you're using IntelliJ and Android Gradle plugin greater than 0.14 you might have this error. I filed a bug for that:
https://youtrack.jetbrains.com/issue/IDEA-134118
Star the issue, vote it up and they might take a closer look :)
Change
classpath 'com.android.tools.build:gradle:1.0.0'
to
classpath 'com.android.tools.build:gradle:0.14.4'
in build.gradle file
You probably have a bad gradle version set in your build.gradle.
try changing your gradle build version in your gradle dependencies like below
dependencies {
classpath 'com.android.tools.build:gradle:0.13.+'
}

Categories

Resources