I am using koin dependency injection in my project but started getting many ANR's in my project though we couldn't reporoduce but real users are getting affected this happened when we updated our compiledSdkVersion and TargetSdkVersion to 32.
koin_version = '2.0.1' current koin version
compiledSdkVersion and TargetSdkVersion is 32.
minSdkVersion 21
There is a new koin version available which is 3.3.2 but they have change the package and we will have to update our whole project to import new package shall we do that?
Any help or suggestion appreciated,
Thanks
at org.koin.core.instance.DefinitionInstance.create(DefinitionInstance.kt:54)
at org.koin.core.instance.SingleDefinitionInstance.get(SingleDefinitionInstance.kt:40)
at org.koin.core.definition.BeanDefinition.resolveInstance(BeanDefinition.kt:70)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:165)
at org.koin.core.scope.Scope.get(Scope.kt:128)
at org.koin.core.scope.Scope.get(Scope.java:83)
at com.mobile.newArch.module.MyApplication.onCreate(MyApplication.kt:124)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7593)
at android.app.ActivityThread.access$1500(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2177)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Related
I am getting this error while building my Kotlin/Android application?
Caused by: java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor812.invoke(Unknown Source)
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)
... 30 more
Caused by: com.sun.tools.javac.processing.AnnotationProcessingError: java.lang.IllegalArgumentException: com.example.MyClassName does not represent a declared type
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:992)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:896)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1222)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1335)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1258)
... 35 more
Caused by: java.lang.IllegalArgumentException: com.example.MyClassName does not represent a declared type
at dagger.shaded.auto.common.MoreTypes$CastingTypeVisitor.defaultAction(MoreTypes.java:948)
at dagger.shaded.auto.common.MoreTypes$CastingTypeVisitor.defaultAction(MoreTypes.java:939)
at jdk.compiler/com.sun.tools.javac.code.Type$ErrorType.accept(Type.java:2394)
at dagger.shaded.auto.common.MoreTypes.asDeclared(MoreTypes.java:579)
at dagger.internal.codegen.base.Keys$1.visitDeclared(Keys.java:89)
at dagger.internal.codegen.base.Keys$1.visitDeclared(Keys.java:66)
at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.accept(Type.java:1151)
at dagger.internal.codegen.base.Keys.isValidImplicitProvisionKey(Keys.java:65)
at dagger.internal.codegen.base.Keys.isValidImplicitProvisionKey(Keys.java:50)
I am using dagger2 for dependency injection, in my application, the application uses a module that has a dependency on another module. What should be the correct way to resolve this dependency?
You'll need an implementation dependency on the module you're consuming, but the recent build flag enableAggregatingTask will do so automatically.
Per google/dagger#2123, bcorso responding to Kshitij09 in November 2020:
You mean I either app should have direct dependency (adding implementation) on :libraryB or :libraryA have api dependency on :libraryB right?
Hi #Kshitij09, yes that's the current solution and we're looking into ways to improve this (see #1991 (comment))
In that same thread, bcorso updates in September 2021:
If you're using Hilt (with Gradle) the solution is to use the Hilt Gradle plugin and then enable the aggregating task in your build.gradle modules:
hilt {
enableAggregatingTask = true
}
The enableAggregatingTask build configuration was introduced in Dagger 2.37 in June 2021 and enabled by default in Dagger 2.40 in October 2021.
// On button click i am tring to open Freshchat -> Conversation screen
Freshchat.showConversations(getApplicationContext());
E/UncaughtException: java.lang.IncompatibleClassChangeError: Class 'com.freshchat.consumer.sdk.activity.ChannelListActivity' does not implement interface 'androidx.lifecycle.LifecycleOwner' in call to 'androidx.lifecycle.Lifecycle androidx.lifecycle.LifecycleOwner.getLifecycle()' (declaration of 'androidx.lifecycle.LiveData' appears in /data/app/com.healthpole.dentists.debug-X-W_P0gIA-gphdr95wNXzg==/base.apk)
at androidx.lifecycle.LiveData.observe(LiveData.java:172)
at androidx.loader.app.LoaderManagerImpl$LoaderInfo.setCallback(LoaderManagerImpl.java:100)
at androidx.loader.app.LoaderManagerImpl.createAndInstallLoader(LoaderManagerImpl.java:400)
at androidx.loader.app.LoaderManagerImpl.restartLoader(LoaderManagerImpl.java:447)
at com.freshchat.consumer.sdk.activity.ChannelListActivity.F(Unknown Source:46)
at com.freshchat.consumer.sdk.activity.ChannelListActivity.onResume(Unknown Source:80)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1412)
at android.app.Activity.performResume(Activity.java:7292)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3776)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3816)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Project Configuration
minimumSdkVersion -> 21
compileSdkVersion -> 28
FreshChat SDK version -> com.github.freshdesk:freshchat-android:2.6.0
and migrated to androidX
NOTE As this lib is not migrated to androidX so
I have tried using the updated version of constraintlayout
also used appcompat-v7-28.0.0 and support-v4-28.0.0 lib still facing the same issue.
so my question is what more dependencies I have to changes or add? what is a workaround with this issue?
So I have asked the question to FreshChat team they have told us to update the dependency of appcompact lib and if still not solved then update other core AndroidX libraries.
So I have updated the appcompact lib to androidx.appcompat:appcompat:1.1.0-beta01 and it is working fine now
I have a legacy application which had following build configurations
targetSdkVersion 23
compileSdkVersion 23
buildToolsVersion 23.0.2
SupportLibVersion 23.4.0
gradle 2.2.0
and I updated them to
gradle version 3.1.4
targetSdkVersion 27
compileSdkVersion 27
buildToolsVersion 27.0.3
SupportLibVersion 27.1.1
Constrain layout 1.0.2
Now when I run the app in emulator or mobile, the app which has home screen as Tablayout viewpager with a number of fragments loading as a list in each page (FragmentPagerAdapter) crashes when I vertically scroll any of the tab items.The actual error I am getting after this upgrade is "No view found for ID of .. fragment". I didn't make any code changes at all, only updated configurations.
I tried to debug this but it seems to be a support library issue. I have verified that I am using same support library version for all different dependencies like appcompat, design, recyclerview, annotation etc. Please suggest a solution.
Note: I tried to downgrade the support library versions and debug, if I change to 23.4.0 the crash doesn't happen, from 25.2.0 onwards it crashes.
Activity state:
09-23 14:14:30.214 11596-11596/com.*** E/AndroidRuntime:
FATAL EXCEPTION: main
Process: com.****, PID: 11596
java.lang.IllegalArgumentException: No view found for id 0x7 (unknown) for fragment ****Fragment{a92e376 #2 id=0x7}
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1293)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:757)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2355)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2008)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
As an example, dynamically loading the following code using the groovyshell-example app found here: https://github.com/pieces029/grooidshell-example/tree/update/build-tools-and-scripts:
def class Outer {
def class Inner {}
}
new Outer.Inner()
Result in Android Emulator API 23
Result = Outer$Inner#a9ea1cd
Result in Android Emulator API 24
Result = null
Stacktrace in API 24
08-13 02:23:03.233 3147-3147/me.champeau.groovydroid E/GrooidShell: Dynamic loading failed!
BUG! exception in phase 'semantic analysis' in source unit 'script14710549832242032452851.groovy' throw with null exception
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:935)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:211)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:221)
at me.champeau.groovydroid.GrooidShell.evaluate(GrooidShell.java:85)
at me.champeau.groovydroid.GroovyActivity.generateMessage(GroovyActivity.groovy:38)
at me.champeau.groovydroid.GroovyActivity.executeCode(GroovyActivity.groovy:31)
at java.lang.reflect.Method.invoke(Native Method)
at android.view.View$DeclaredOnClickListener.onClick(View.java:4693)
at android.view.View.performClick(View.java:5610)
at android.view.View$PerformClick.run(View.java:22260)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.NullPointerException: throw with null exception
at java.net.URLClassLoader.findClass(URLClassLoader.java:371)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:545)
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:185)
at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:170)
at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:126)
at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:676)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:308)
at org.codehaus.groovy.control.ResolveVisitor.resolveNestedClass(ResolveVisitor.java:341)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:308)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:276)
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:260)
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:272)
at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:1047)
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:706)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:142)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1318)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:53)
08-13 02:23:03.234 3147-3147/me.champeau.groovydroid E/GrooidShell: at org.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:201)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1078)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1261)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:176)
at org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:651)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931)
... 21 more
The version of the DX library included in that project is 1.7. Where the best I can tell by opening up the dx.jar file included with the latest (24.1.1) build tools is 1.12. I am guessing that similar to Java backwards compatibility is kept in place but lower versions will not run on newer version.
On that note, I would guess that someone just posted the dx jar to central and that is not an official google release. I think the best bet would be to reference the jar that is included in the build tools you are compiling with.
I am getting an Error while installing apk in android 5.1.
Package couldn't be installed in /data/app/com.acelrtech.apps.xxxxxxxxx-1
com.android.server.pm.PackageManagerException: scanPackageLI
at com.android.server.pm.PackageManagerService.scanPackageDirtyLI(PackageManagerService.java:6313)
at com.android.server.pm.PackageManagerService.scanPackageLI(PackageManagerService.java:5605)
at com.android.server.pm.PackageManagerService.installNewPackageLI(PackageManagerService.java:10550)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:11128)
at com.android.server.pm.PackageManagerService.access$2800(PackageManagerService.java:241)
at com.android.server.pm.PackageManagerService$6.run(PackageManagerService.java:8993)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Here is the Gradle main part looks looks like . Hoping for a better input.
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.acelrtech.apps.xxxxxxxxxxxx”
minSdkVersion 14
targetSdkVersion 21
versionCode 23
versionName "2016.6.21"
generatedDensities = []
multiDexEnabled true
}
Also i tried the this solution ..