Comments (1)
OK, I myself came up with a little modification to code. This might not be the right way but it does the job for me.
The Reason the No Class Def Found error occurs is because the CallScreeningService was introduced in Android N and hence the version below gets the runtime exception @https://developer.android.com/reference/kotlin/android/telecom/CallScreeningService
for Solution to this you have to create 2 different AppComponent's and ServiceBuilderModule's
- This ServiceBuilderModule1 module is for Android N and above which has both abstract funtions i.e applockerService() & callBlockerService()
ServiceBuilderModule1
@Module
abstract class ServiceBuilderModule1 {
@ContributesAndroidInjector
abstract fun appLockerService(): AppLockerService
@ContributesAndroidInjector
abstract fun callBlockerService(): CallBlockerScreeningService
}
- Now we have to create a second Module ServiceBuilderModule2 that will hold only appLocker() method. and this will be used when the API level < Android N. As CallScreeningService was introduced in AndroidN so we cannot use it below N.
ServiceBuilderModule2
@Module
abstract class ServiceBuilderModule2 {
@ContributesAndroidInjector
abstract fun appLockerService(): AppLockerService
}
- Now create a copy of AppComponent. The only difference will be the replacement of ServiceBuilderModule1 & 2.
AppComponent
@Singleton
@Component(
modules = [
AndroidSupportInjectionModule::class,
ActivityBuilderModule::class,
ServiceBuilderModule1::class, <--- Replace ServiceBuilderModule2 in other i.e AppComponent2
BroadcastReceiverBuilderModule::class,
AppModule::class,
DatabaseModule::class]
)
interface AppComponent2 : AndroidInjector<AppLockerApplication> {
@Component.Builder
abstract class Builder : AndroidInjector.Builder<AppLockerApplication>()
}
- Now for the final touch Change the Override method androidInjector() in AppLockerApplication class like below.
override fun applicationInjector(): AndroidInjector<out DaggerApplication> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
return DaggerAppComponent.builder().create(this)
return DaggerAppComponent2.builder().create(this)
}
I hope this helps someone in someway and if i am wrong at this kindly do suggest a valid solution to this problem. for me i have tested this on Android 5.0 till Android 9 and it works just fine with this solution so i thought i should share it here
from applocker.
Related Issues (13)
- Please tell me where app id and targetSdkVersion etc are HOT 1
- The minCompileSdk (31) specified in a HOT 1
- please make it compatible with latest android version
- Dead project?
- can not build the project
- Overlay permsion not working it never asks for overlay never HOT 1
- Settings.ACTION_USAGE_ACCESS_SETTINGS
- io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with HOT 1
- uninstalled easily!! Don't ask pattern
- Applock overlay screen not working correctly HOT 1
- App Locker not working properly in Andriod 10 goes behind app HOT 1
- when importing images app crash
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from applocker.