android tablayout/tab remove padding

Remove Padding from Tabs when using TabLayout and ViewPager
Reson to remoe padding from tabs:
1. Padding from Tabs when using Custom views with Tab Layout

 <com.google.android.material.tabs.TabLayout
        app:layout_constraintTop_toBottomOf="@id/viewpager"
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        app:tabSelectedTextColor="@color/colorPrimaryDark"
        app:tabTextColor="@color/colorWhite"
        android:layout_height="wrap_content"/>
Through XML you can remove only the left and right paddings like that:
 app:tabPaddingEnd="0dp"
 app:tabPaddingStart="0dp"
Notice, that this way doesn`t work for TOP and BOTTOM paddings, but I find next solution:

Before removing tab padding - the 3rd tab text size "WITHDRAWALS" is smaller compare to 1st two tabs. 

After removing extra tab padding - All tabs have text size.

 <com.google.android.material.tabs.TabLayout
        app:layout_constraintTop_toBottomOf="@id/viewpager"
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        app:tabPaddingStart="0dp"
        app:tabPaddingEnd="0dp"
        app:tabSelectedTextColor="@color/colorPrimaryDark"
        app:tabTextColor="@color/colorWhite"
        android:layout_height="wrap_content"/>

PackageManager: Package signatures do not match the previously installed version; ignoring!

Issue Details:  signatures do not match the previously installed version; ignoring!
Mainly this issue happens when you try to install app with the same package name but not signed with the same Key-store file.

Steps how issue generated:
1) Installed App from the Google Play (with Current App version 1.2 and version code 3004).
2) Use Android Studio and make new release APK having version 1.3 and version code 3005
3) I start update from app version(1.2) to version(1.3) to test whether app will update to new version 1.3 properly.
4) I come across blow error:

Here is the screenshot while updating my app installed from the Google Play (with Current App version 1.2) to New release APK (version 1.3).
It shows message App Not Installed

Android Studio Warning Log in Details:
11-18 11:49:03.466 1487-1518/? W/PackageManager: Package com.geekscompete.gate_isro_cs.ugc_net_preparation signatures do not match the previously installed version; ignoring!

Understanding Original APK, Derived APK, App Signing Certificate and Upload Certificate
Then, I followed common stuffs like invalidate and restart studio, clean project, and Make new release APK but No Luck!
I open Google Play Console and check if the SHA-1 generated from release keystore is same as the Upload Certificate SHA-1:
You can derive the SHA-1 for release apk after using below command:
keytool -list -v -keystore {keystore_name} -alias {alias_name}
SHA-1 from my release keystore and Upload Certificate SHA-1 is matching!

There is one other Certificate "App Signing Certificate" which Google Play uses to sign your app before distributing it to Android devices.

App Signing Certificate:
certificate for the app signing key that Google Play uses to sign your app before distributing it to Android devices. The app signing key itself is inaccessible and kept on a secure Google server. Use the certificate below to register your app signing key with your API providers.

Upload Certificate ():
certificate for the upload key that you hold privately. Use your upload key to sign each release so that Google Play knows the release comes from you. Use the certificate below to register your app signing key with your API providers for app testing purposes.

and After visiting my Google Play Console: Release Management -> App Signing
I have "OPT IN" for Google App Signing. : "App Signing by Google is enabled for this app".
If You have OPT-OUT of Google signing then your APK will not signed by the Google and Available apk to all users will be same as your uploaded APK to Google Play Console.

If you visit Google Developer account as mentioned below:
Release Management -> App Releases -> Production Track (Click manage)
And Click Latest APK download option -> You can see two option to Download APK files Original APK and Derived APK(If you have opt-in for Google Signing).

Original APK: APK file which you have uploaded after signing with the release Key-store (using .jks file) and upload it to the Google Play Console for making it live.
(Uses Upload Certificate to Verify new app version upload to Google Play Console)

Derived APK: This is the APK which is available to the users to download from Google Play Store after your app goes live.

Reasons for this issue is signatures mismatch:
APK download from Google Play Store is signed using App Signing Certificate.
Whereas release APK generated from Android Studio is using Upload Keystore file with .jks extension.

So, Signature of Upload Certificate and App Signing Certificate will not match.
Then I come across this amazing post:
Which gave Me Idea about APK Derived APK and Original APK, Signature mismatch:
https://readyandroid.wordpress.com/app-not-installedthe-package-conflicts-with-an-existing-package-by-the-same-name-android/

Derived APK -> https://stackoverflow.com/questions/44599767/google-maps-not-working-in-derived-apk-published-app#answer-49692374
For derive apk google introduce App singing feature. Google sign you apk agian, so you have to get App Sigining certificate's SHA1 and set it into Google Cloud Platform (wher you set your package name and SHA1)



Fatal Exception: java.lang.NoClassDefFoundError: android.app.ANRManagerProxy

Crashlytics Issue Details:

I come across this rarely found only 1 crash in last 90 days on device alps -> A3-7 PLUS DUO and on Android 4.2.2 (Android 4.2 Jelly Bean (API 17)) Operating Systems. I found detail of Crash Insights in Firebase Crashlytics and posting here.

Crash Log in Details :   java.lang.NoClassDefFoundError: android.app.ANRManagerProxy

Fatal Exception: java.lang.NoClassDefFoundError: android.app.ANRManagerProxy
android.app.ANRManagerNative.asInterface + 30 (ANRManagerNative.java:30)
android.app.ANRManagerNative$1.create + 94 (ANRManagerNative.java:94)
android.app.ANRManagerNative$1.create + 88 (ANRManagerNative.java:88)
android.util.Singleton.get + 34 (Singleton.java:34)
android.app.ANRManagerNative.getDefault + 37 (ANRManagerNative.java:37)
android.os.MessageLogger.dump + 253 (MessageLogger.java:253)
android.app.ANRAppManager.dumpMessageHistory + 38 (ANRAppManager.java:38)
android.app.ActivityThread$ApplicationThread.dumpMessageHistory + 1176 (ActivityThread.java:1176)
android.app.ApplicationThreadNative.onTransact + 609 (ApplicationThreadNative.java:609)
android.os.Binder.execTransact + 351 (Binder.java:351)
dalvik.system.NativeStart.run (NativeStart.java)

Reason For Such Crash report:

This issue is triggered when your app experiences an ANR on devices running custom firmware that is missing the ANRManagerProxy class. To mitigate this issue, look for areas in your code that may block the main thread for extended periods of time. Check out the first resource for more details.

I have set below code in MainActivity.java class:
So, that I can allow network calls, database read and write and other heavy work in Main (GUI) thread. See more on StrictMode.ThreadPolicy.Builder().permitAll().build()
public void onCreate() {
StrictMode.ThreadPolicy policy;
policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
}

Solution:

So. According to below reference its suggested to use the StrictMode.ThreadPolicy.Builder for Development and testing. Only thing you can do about this is to make your app responsive. Best way to do so is to use during development and testing Strict Mode, i.e., to do something like this:
public void onCreate() {
    if (DEVELOPER_MODE) {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
             .detectDiskReads()
             .detectDiskWrites()
             .detectNetwork()   // or .detectAll() for all detectable problems
             .penaltyLog()
             .build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
             .detectLeakedSqlLiteObjects()
             .detectLeakedClosableObjects()
             .penaltyLog()
             .penaltyDeath()
             .build());
    }
    super.onCreate();
}

Best reference:

https://stackoverflow.com/questions/29289641/noclassdeffounderror-android-app-anrmanagerproxy

More on StrictMode.ThreadPolicy.Builder:
Creates ThreadPolicy instances. Methods whose names start with detect specify what problems we should look for. Methods whose names start with penalty specify what we should do when we detect a problem.

You can call as many detect and penalty methods as you like. Currently order is insignificant: all penalties apply to all detected problems.

For example, detect everything and log anything that's found:
 StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
     .detectAll()
     .penaltyLog()
     .build();
 StrictMode.setThreadPolicy(policy);

[databinding] {"msg":"Missing import expression although it is registered

[kapt] An exception occurred: android.databinding.tool.util.LoggedErrorException: Found data binding error(s):

[databinding] {"msg":"Missing import expression although it is registered","file":"/home/espl/Documents/Desktop/d2/ocd/ocdlive_3.0.7_live_i_android_x_call (2)/app/src/main/res/layout/item_notif.xml","pos":[]}

at android.databinding.tool.processing.Scope.assertNoError(Scope.java:111)
at android.databinding.annotationprocessor.ProcessDataBinding.doProcess(ProcessDataBinding.java:124)
at android.databinding.annotationprocessor.ProcessDataBinding.process(ProcessDataBinding.java:88)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:132)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$200(JavacProcessingEnvironment.java:91)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.runContributingProcs(JavacProcessingEnvironment.java:627)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1033)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1198)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1068)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:80)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:36)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:223)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:187)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:98)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:82)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:384)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:70)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:375)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:123)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:131)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:103)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:442)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:1023)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:1065)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:1022)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:441)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

java.lang.IndexOutOfBoundsException Inconsistency detected. Invalid item position 6(offset:6).state:8 androidx.recyclerview

Fatal Exception: java.lang.IndexOutOfBoundsException
Inconsistency detected. Invalid item position 6(offset:6).state:8 androidx.recyclerview.widget.RecyclerView{7eb7afc VFED..... ........ 0,0-1080,91 #7f08018c app:id/popular_store_filter}, adapter:com.elitech.offers.coupons.deals.v2.offers.adapter.PopularFilterListAdapter@9a45585, layout:androidx.recyclerview.widget.LinearLayoutManager@6e51fda, context:com.elitech.offers.coupons.deals.MainActivity@fd20deb
androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline (RecyclerView.java:5923)
androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5858)
androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5854)
androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next (LinearLayoutManager.java:2230)
androidx.recyclerview.widget.LinearLayoutManager.layoutChunk (LinearLayoutManager.java:1557)
androidx.recyclerview.widget.LinearLayoutManager.fill (LinearLayoutManager.java:1517)
androidx.recyclerview.widget.LinearLayoutManager.scrollBy (LinearLayoutManager.java:1331)
androidx.recyclerview.widget.LinearLayoutManager.scrollHorizontallyBy (LinearLayoutManager.java:1063)
androidx.recyclerview.widget.RecyclerView.scrollStep (RecyclerView.java:1829)
androidx.recyclerview.widget.RecyclerView$ViewFlinger.run (RecyclerView.java:5067)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:860)
android.view.Choreographer.doCallbacks (Choreographer.java:672)
android.view.Choreographer.doFrame (Choreographer.java:605)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:846)
android.os.Handler.handleCallback (Handler.java:742)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:157)
android.app.ActivityThread.main (ActivityThread.java:5603)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:774)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:652)

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder Android RecyclerView

10-24 12:43:18.799 6901-6901/com.elitech.offers.coupons.deals E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.elitech.offers.coupons.deals, PID: 6901
    java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{5f02890 position=7 id=-1, oldPos=-1, pLpos:-1 no parent} androidx.recyclerview.widget.RecyclerView{6c5df4a VFED..... ........ 0,0-1080,91 #7f08018c app:id/popular_store_filter}, adapter:com.elitech.offers.coupons.deals.v2.offers.adapter.PopularFilterListAdapter@984cebb, layout:androidx.recyclerview.widget.LinearLayoutManager@42b2fd8, context:com.elitech.offers.coupons.deals.MainActivity@d4e5a45
        at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5715)
        at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5898)
        at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:286)
        at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:343)
        at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:359)
        at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:366)
        at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:397)
        at android.os.Handler.handleCallback(Handler.java:742)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:157)
        at android.app.ActivityThread.main(ActivityThread.java:5603)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)

java.lang.IllegalStateException: An instance of OnFlingListener already set

10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err: java.lang.IllegalStateException: An instance of OnFlingListener already set.
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at androidx.recyclerview.widget.SnapHelper.setupCallbacks(SnapHelper.java:113)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at androidx.recyclerview.widget.SnapHelper.attachToRecyclerView(SnapHelper.java:101)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.geekscompete.gate_isro_cs.ugc_net_preparation.v2.HomeRecyclerViewAdapter.addSlidersRV(HomeRecyclerViewAdapter.java:3288)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.geekscompete.gate_isro_cs.ugc_net_preparation.v2.HomeRecyclerViewAdapter.access$1400(HomeRecyclerViewAdapter.java:146)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.geekscompete.gate_isro_cs.ugc_net_preparation.v2.HomeRecyclerViewAdapter$11.onSuccess(HomeRecyclerViewAdapter.java:3180)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.geekscompete.gate_isro_cs.ugc_net_preparation.network.NetworkUtility$1.onResponse(NetworkUtility.java:156)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.geekscompete.gate_isro_cs.ugc_net_preparation.network.NetworkUtility$1.onResponse(NetworkUtility.java:140)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.geekscompete.gate_isro_cs.ugc_net_preparation.network.CacheRequest.deliverResponse(CacheRequest.java:99)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.geekscompete.gate_isro_cs.ugc_net_preparation.network.CacheRequest.deliverResponse(CacheRequest.java:19)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:102)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at android.os.Handler.handleCallback(Handler.java:742)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at android.os.Looper.loop(Looper.java:157)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5603)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
10-12 12:35:15.151 14322-14322/com.geekscompete.gate_isro_cs.ugc_net_preparation W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)

android.os.FileUriExposedException: exposed beyond app through ClipData.Item.getUri()

 Process: com.example.espl.nivedhfieldworker, PID: 31238
    android.os.FileUriExposedException: file:///storage/emulated/0/.NivedhFieldWorker/1569647128471.jpg exposed beyond app through ClipData.Item.getUri()
        at android.os.StrictMode.onFileUriExposed(StrictMode.java:1993)
        at android.net.Uri.checkFileUriExposed(Uri.java:2379)
        at android.content.ClipData.prepareToLeaveProcess(ClipData.java:963)
        at android.content.Intent.prepareToLeaveProcess(Intent.java:10227)
        at android.content.Intent.prepareToLeaveProcess(Intent.java:10212)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1736)
        at android.app.Activity.startActivityForResult(Activity.java:4590)
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676)
        at androidx.core.app.ActivityCompat.startActivityForResult(ActivityCompat.java:234)
        at androidx.fragment.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:796)
        at androidx.fragment.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment(FragmentActivity.java:933)
        at androidx.fragment.app.Fragment.startActivityForResult(Fragment.java:1197)
        at androidx.fragment.app.Fragment.startActivityForResult(Fragment.java:1185)
        at com.example.espl.nivedhfieldworker.photo_capture.PhotoCaptureFragment.openBackCamera(PhotoCaptureFragment.kt:587)
        at com.example.espl.nivedhfieldworker.photo_capture.PhotoCaptureFragment.access$openBackCamera(PhotoCaptureFragment.kt:61)
        at com.example.espl.nivedhfieldworker.photo_capture.PhotoCaptureFragment$onCreateView$1.onClick(PhotoCaptureFragment.kt:142)
        at android.view.View.performClick(View.java:6600)
        at android.view.View.performClickInternal(View.java:6577)
        at android.view.View.access$3100(View.java:781)
        at android.view.View$PerformClick.run(View.java:25912)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6912)
        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:860)

android room update query example

@Query("UPDATE inwardattendenceob SET url_local=:filePath WHERE Carton_Id =:carton_id")
    fun updateCartonInwardImageFilepath(filePath:String,carton_id:String)

'App not Installed' Error on Android

Photo_missing
For me, On Android 9 (API 28), disabling Google Play Protect from play store app worked the trick, and i was able to get rid of the App not Installed error.

Follow steps to disable play protect and then install APK/App:
To disable Google Play Protect.
1. Open "Play Store" application => 2. tap on Menu button => 3. select "Play Protect" option => 4. Disable the options "Scan device for security threats".

shortcut to convert lowercase to uppercase in android studio

https://stackoverflow.com/questions/25494740/is-there-a-shortcut-on-android-studio-to-convert-a-text-to-uppercase

Using edit menu item:
Select the text, then go to Edit → Toggle Case (Ctrl+Shift+U on Windows).

Ubuntu:
You need to keep Caps Lock on while using this shortcut.

I could not get the shortcut Ctrl+Shift+U to work in Android Studio on Ubuntu 14.04 until I turned on Caps Lock.

shortcut on Mac:
The IntelliJ shortcut is evidently Ctrl+Shift+U (Command+Shift+U on Mac) and should work since Android Studio is based off of it.

on Windows:
Andriod studio shortcut Ctrl+Shift+U on Windows.
So If above shortcut not work then you  kept CAPS LOCK ON and should try with CTRL+SHIFT+U and its worked perfectly.

androidx.fragment.app.fragmentstatepageradapter deprecated

https://developer.android.com/reference/androidx/fragment/app/FragmentStatePagerAdapter.html#FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager)

Recently the androidx.fragment.app.FragmentManager is deprecated
It is not deprecated at the present time. For example, it is not marked as deprecated in the documentation.

'FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager)' is deprecated
The single-parameter FragmentStatePagerAdapter constructor is deprecated. However, if you read the documentation for that constructor, you will find:
This constructor is deprecated.
use FragmentStatePagerAdapter(FragmentManager, int) with BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT

So, replace FragmentStatePagerAdapter(fm) with FragmentStatePagerAdapter(fm, FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT), to retain the functionality from the original one-parameter constructor.

Using 'getString' to get device identifiers is not recommended

Kotlin code:
@JvmStatic
    val udid: String?
        get() {
            try {
                return Settings.Secure.getString(MyApplication.get().contentResolver, Settings.Secure.ANDROID_ID)
            } catch (e: Exception) {
                e.fillInStackTrace()
            }

            return null

        }

Android Java code:
String deviceID = Settings.Secure.getString(getApplicationContext().getContentResolver(),
        Settings.Secure.ANDROID_ID);

Best References:
https://stackoverflow.com/questions/47691310/why-is-using-getstring-to-get-device-identifiers-not-recommended
https://developer.android.com/training/articles/user-data-ids.html

Cleartext Http Traffic not Permitted Android 9

Android Studio Error Log: java.io.IOException: Cleartext HTTP traffic to my_IP/domain not permitted

2019-09-06 12:20:29.050 22531-22531/com.geekscompete.gate_isro_cs.ugc_net_preparation E/VolleyError:: ::com.android.volley.NoConnectionError: java.io.IOException: Cleartext HTTP traffic to http://geekscompete.com/ not permitted

Reason for this error:
According to Network security configuration - Opt out of cleartext traffic
Note: The guidance in this section applies only to apps that target Android 8.1 (API level 27) or lower. Starting with Android 9 (API level 28), cleartext support is disabled by default. Network security configuration also suggest to ensure that all connections to your domain are always done over HTTPS to protect sensitive traffic from hostile networks.

You have to create a new file in your xml folder, file named network_security_config.xml.
res/xml/network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">yourdomain.com</domain>
        <domain includeSubdomains="true">geekscompete.com</domain>
        <domain includeSubdomains="true">geekscompete.blogspot.com</domain>
    </domain-config>
</network-security-config>

This config will now allow clear traffic to your specified domains after you . Make sure that you have set android:networkSecurityConfig="@xml/network_security_config" in the application tag of your AndroidManifest.xml. The content of your config file should contain all URLs which requests clear traffic without encryption. As shown in below code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.yourappname">
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name=".MainApplication"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:allowBackup="false"
        android:supportsRtl="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:theme="@style/AppTheme">
    </application>
</manifest>


Related Articles: 


java.util.concurrent.TimeoutException android.os.BinderProxy.finalize() timed out after 10 seconds

Fatal Exception: java.util.concurrent.TimeoutException
android.os.BinderProxy.finalize() timed out after 10 seconds
android.os.BinderProxy.destroy (BinderProxy.java)
android.os.BinderProxy.finalize (BinderProxy.java:540)
java.lang.Daemons$FinalizerDaemon.doFinalize (Daemons.java:191)
java.lang.Daemons$FinalizerDaemon.run (Daemons.java:174)
java.lang.Thread.run (Thread.java:818)

android.content.res.resources$notfoundexception: vector drawable

03-11 16:46:57.893 25554-25554/com.elitech.offers.coupons.deals E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.elitech.offers.coupons.deals, PID: 25554
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.elitech.offers.coupons.deals/com.elitech.offers.coupons.deals.cityselection.CityListActivity}: android.view.InflateException: Binary XML file line #150: Error inflating class TextView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2429)
        at android.app.ActivityThread.access$800(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1342)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:5333)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #150: Error inflating class TextView
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater.inflate(ViewPumpLayoutInflater.java:55)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at com.elitech.offers.coupons.deals.cityselection.CityListActivity.onCreate(CityListActivity.java:107)
        at android.app.Activity.performCreate(Activity.java:5343)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2331)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2429)
        at android.app.ActivityThread.access$800(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1342)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:5333)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_search_loc.xml from drawable resource ID #0x7f070169
        at android.content.res.Resources.loadDrawable(Resources.java:2170)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
        at android.widget.TextView.<init>(TextView.java:841)
        at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:87)
        at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:83)
        at android.support.v7.app.AppCompatViewInflater.createTextView(AppCompatViewInflater.java:177)
        at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:102)
        at android.support.v7.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
        at android.support.v7.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater$WrapperFactory2ViewCreator.onCreateView(ViewPumpLayoutInflater.java:367)
        at io.github.inflationx.viewpump.FallbackViewCreationInterceptor.intercept(FallbackViewCreationInterceptor.java:11)
        at io.github.inflationx.viewpump.InterceptorChain.proceed(InterceptorChain.java:37)
        at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
        at io.github.inflationx.viewpump.InterceptorChain.proceed(InterceptorChain.java:37)
        at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.java:49)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater$WrapperFactory2.onCreateView(ViewPumpLayoutInflater.java:348)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater.inflate(ViewPumpLayoutInflater.java:55)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at com.elitech.offers.coupons.deals.cityselection.CityListActivity.onCreate(CityListActivity.java:107)
        at android.app.Activity.performCreate(Activity.java:5343)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2331)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2429)
        at android.app.ActivityThread.access$800(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1342)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:5333)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
        at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)



        SOL 1:
     
        static {
        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
        }

        Not helped above soution::

        SOL 2: Helped is to set the vector drawable programetically:
         tv_my_current_location.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_search_loc,0, 0, 0);

E/WindowManager: android.view.WindowLeaked: Activity

10-13 16:00:29.760 27725-27725/com.example.DemoApp E/WindowManager: android.view.WindowLeaked: Activity com.example.DemoApp.V2.DealofTheDayActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{65f438d V.E...... R.....I. 0,0-1080,1920} that was originally added here
        at android.view.ViewRootImpl.<init>(ViewRootImpl.java:373)
        at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:302)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:86)
        at android.app.Dialog.show(Dialog.java:322)
        at com.example.DemoApp.BaseActivity$4.onResourceReady(BaseActivity.java:754)
        at com.example.DemoApp.BaseActivity$4.onResourceReady(BaseActivity.java:723)
        at com.bumptech.glide.request.SingleRequest.onResourceReady(SingleRequest.java:568)
        at com.bumptech.glide.request.SingleRequest.onResourceReady(SingleRequest.java:530)
        at com.bumptech.glide.load.engine.EngineJob.handleResultOnMainThread(EngineJob.java:218)
        at com.bumptech.glide.load.engine.EngineJob$MainThreadCallback.handleMessage(EngineJob.java:324)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:157)
        at android.app.ActivityThread.main(ActivityThread.java:5604)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)

android.content.res.Resources$NotFoundException: File res/drawable/try_angle.xml from drawable resource ID

01-29 13:10:13.126 1634-1634/com.elitech.offers.coupons.deals W/System.err: android.content.res.Resources$NotFoundException: File res/drawable/try_angle.xml from drawable resource ID #0x7f0701c6
01-29 13:10:13.130 1634-1634/me.me2.com.myapp W/System.err:     at android.content.res.Resources.loadDrawable(Resources.java:2170)
01-29 13:10:13.130 1634-1634/me.me2.com.myapp W/System.err:     at android.content.res.Resources.getDrawable(Resources.java:710)
01-29 13:10:13.130 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:465)
01-29 13:10:13.130 1634-1634/me.me2.com.myapp W/System.err:     at me.me2.com.myapp.V2.HomeRecyclerViewAdapter.onBindViewHolder(HomeRecyclerViewAdapter.java:1055)
01-29 13:10:13.130 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6781)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6823)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5752)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6019)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3875)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3639)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1877)
01-29 13:10:13.131 1634-1634/me.me2.com.myapp W/System.err:     at android.support.v7.widget.RecyclerView$1.run(RecyclerView.java:407)
01-29 13:10:13.132 1634-1634/me.me2.com.myapp W/System.err:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788)
01-29 13:10:13.134 1634-1634/me.me2.com.myapp W/System.err:     at android.view.Choreographer.doCallbacks(Choreographer.java:591)
01-29 13:10:13.134 1634-1634/me.me2.com.myapp W/System.err:     at android.view.Choreographer.doFrame(Choreographer.java:559)
01-29 13:10:13.134 1634-1634/me.me2.com.myapp W/System.err:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774)
01-29 13:10:13.134 1634-1634/me.me2.com.myapp W/System.err:     at android.os.Handler.handleCallback(Handler.java:808)
01-29 13:10:13.134 1634-1634/me.me2.com.myapp W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:103)
01-29 13:10:13.134 1634-1634/me.me2.com.myapp W/System.err:     at android.os.Looper.loop(Looper.java:193)
01-29 13:10:13.134 1634-1634/me.me2.com.myapp W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5333)
01-29 13:10:13.135 1634-1634/me.me2.com.myapp W/System.err:     at java.lang.reflect.Method.invokeNative(Native Method)
01-29 13:10:13.135 1634-1634/me.me2.com.myapp W/System.err:     at java.lang.reflect.Method.invoke(Method.java:515)
01-29 13:10:13.135 1634-1634/me.me2.com.myapp W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
01-29 13:10:13.137 1634-1634/me.me2.com.myapp W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
01-29 13:10:13.137 1634-1634/me.me2.com.myapp W/System.err:     at dalvik.system.NativeStart.main(Native Method)
01-29 13:10:13.137 1634-1634/me.me2.com.myapp W/System.err: Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: invalid drawable tag vector
01-29 13:10:13.138 1634-1634/me.me2.com.myapp W/System.err:     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
01-29 13:10:13.138 1634-1634/me.me2.com.myapp W/System.err:     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
01-29 13:10:13.138 1634-1634/me.me2.com.myapp W/System.err:     at android.content.res.Resources.loadDrawable(Resources.java:2166)
01-29 13:10:13.138 1634-1634/me.me2.com.myapp W/System.err:  ... 30 more

android.database.sqlite.SQLiteConstraintException: NOT NULL constraint failed:

Reason for Exception is that Gson treats “missing” values as “null”
Caused by: android.database.sqlite.SQLiteConstraintException:
NOT NULL
constraint failed: (code 1299 SQLITE_CONSTRAINT_NOTNULL)
You might come across this error when you are using Room database on Android. This happens because the generated schema for your tables mark some of the table’s columns as NOT NULL.

For example, if you Entity class looks like this:

Model Class Book:
package com.geekscompete.gate_isro_cs.ugc_net_preparation.database.models

import androidx.room.Entity
import androidx.room.PrimaryKey
import com.geekscompete.gate_isro_cs.ugc_net_preparation.database.BaseOb

@Entity(tableName = "book")
class Book(
        @PrimaryKey(autoGenerate = true)
        var objectId: Int = 0,

        id: String ="",
        data: String = "",
        title: String ="",
        description: String ="",
        last_updated: String ="",
        logo_url: String ="",
        orderno: Int = 0,
        tags: String="",
        type: Int = -1,
        btm_color: String="#F0513C",

       var price: Int,
        var redirect_url: String,
        var tag: String
): BaseOb(id,data,title,description,last_updated,logo_url,orderno,tags,type,btm_color)

Data I am getting from API is as below:
{
id: 1,
title: "NTA UGC NET/SET/JRF - Paper 1",
description: "This book, in its third edition, is designed and developed for students who aspire to build a career in academics and research field",
image_url: "https://images-na.ssl-images-amazon.com/images/I/71%2BZPvi7ZlL.jpg",
store_logo_url: "https://images-na.ssl-images-amazon.com/images/G/01/rainier/available_at_amazon_1200x600_Nvz5h2M.png",
price: 411,
redirect_url: "https://www.amazon.in/NTA-UGC-NET-SET-JRF/dp/9353433746/ref=as_li_ss_il?crid=2EYYT7DF8WXMX&keywords=ugc+net+paper+1+2019&qid=1564293960&s=gateway&sprefix=ugc+net+,aps,281&sr=8-1-spons&psc=1&linkCode=li2&linkId=8424f35e3b5163df827e84af24007fb9&language=en_IN",
tag: "UGC NET PAPER 1"
}

There was no data field in the API response and I am parsing using Gson.
The generated columns like title, description, data and logo_url will be marked as NOT NULL. And thus, when you try to add a record with one of these values as null, you will get an SQLiteConstraintException.
val title: String
In Kotlin, this means that title can never be null.

To fix this, you just need to change the Entity class a bit, and allow the fields to be Nullable.
@Entity(tableName = "books")
data class Book(
    @PrimaryKey
    val id: Int,
    val title: String?,
    val description: String?,
    val info: String?,
    val type: Int,
    val url: String?
)

08-31 18:19:06.031 8364-8450/com.geekscompete.gate_isro_cs.ugc_net_preparation E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
    Process: com.geekscompete.gate_isro_cs.ugc_net_preparation, PID: 8364
    android.database.sqlite.SQLiteConstraintException: NOT NULL constraint failed: book.data (code 1299)
        at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
        at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:780)
        at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
        at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
        at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.java:51)
        at androidx.room.EntityInsertionAdapter.insert(EntityInsertionAdapter.java:97)
        at com.geekscompete.gate_isro_cs.ugc_net_preparation.database.models.BookNewDao_Impl.insertAll(BookNewDao_Impl.java:267)
        at com.geekscompete.gate_isro_cs.ugc_net_preparation.quiz_attempts.QuizListFragment_new$getBooks$1$1.run(QuizListFragment_new.kt:410)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)

References best:
https://techdroid.kbeanie.com/2018/11/24/room-database-kotlin-nullable-column/
https://www.bignerdranch.com/blog/when-nullability-lies-a-cautionary-tale/

[TAG] Failed to resolve variable '${project.version}'






[TAG] Failed to resolve variable '${project.version}'
[TAG] Failed to resolve variable '${animal.sniffer.version}'
build failed 2 m 37 s 260 ms : Compilation error. See log for more details


org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:kaptDebugKotlin'.
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:145)
at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:115)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:62)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:49)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:kaptDebugKotlin'.
at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:74)
at org.gradle.initialization.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
at org.gradle.initialization.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:30)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:143)
at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:115)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:62)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:49)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptDebugKotlin'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
... 3 more
Caused by: org.gradle.api.GradleException: Compilation error. See log for more details
at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:14)
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:121)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:144)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:139)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompilerAsync(GradleKotlinCompilerRunner.kt:79)
at org.jetbrains.kotlin.gradle.internal.KaptWithKotlincTask.compile(KaptWithKotlincTask.kt:98)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
... 30 more

Android Studio Emulator Error: KVM is required to run this AVD. /dev/kvm is not found. (Ubuntu)




KVM is required to run this AVD.
/dev/kvm is not found.

Enable VT-x in your BIOS security settings, ensure that your Linux distro has working KVM module.

#############################################3
Suggestion post::
Use the below command to check whether the KVM is installed in the machine or not,

kvm-ok
Output:

INFO: /dev/kvm exists
KVM acceleration can be used
Output like the below means,

INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used
In this scenario need to install KVM using the below command,

sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
Hope this helps.

##############################
Steps I followed::
1. Check

espl@espl-All-Series:~$ sudo kvm-ok
[sudo] password for espl:
INFO: /dev/kvm does not exist
HINT:   sudo modprobe kvm_intel
INFO: Your CPU supports KVM extensions
INFO: KVM (vmx) is disabled by your BIOS
HINT: Enter your BIOS setup and enable Virtualization Technology (VT),
      and then hard poweroff/poweron your system
KVM acceleration can NOT be used




android room unique constraint (Kotlin)

Kotlin code:


Single column unique (e.g. id_key only).

@Entity(tableName = "user",indices = [(Index(value = ["id_key"], unique = true))])
data class User (

  @PrimaryKey(autoGenerate = true)
    var id: Int = 0
 
  @ColumnInfo(name = "id_key")
    var id_key: String = ""

    @ColumnInfo(name = "first_name")
    var first_name: String = ""

@ColumnInfo(name = "last_name")
    var last_name: String = ""
}


How to add unique constraint in room database to multiple column

Combine two columns to be unique (e.g. first_name and last_name).

@Entity(tableName = "user",indices = arrayOf(Index(value = ["first_name", "last_name"], unique = true)))
data class User (
.....
}


Multiple unique constaints.

@Entity(tableName = "user", indices = [Index(value = ["id_key"]),Index(value = ["first_name", "last_name"],unique = true)])
....
}

launcher icon not showing android oreo/pie


<activity
                android:name=".RegisterActivity"
                android:screenOrientation="portrait"
                android:noHistory="true"
                android:launchMode= "singleTask"
                android:theme="@style/AppThemeHome">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>

</activity>

Moved the below intent filters from RegisterActivity to MainActivity.

 <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>

 After moving the above two intent decleration to the MainActivity and my launcher icon stop showing.

<activity android:name=".MainActivity"
                  android:launchMode= "singleTask"
                  android:screenOrientation="portrait"
                  android:theme="@style/AppThemeHome">

            <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>

               <category android:name="android.intent.category.LAUNCHER"/>

                <category android:name="android.intent.category.DEFAULT"/>

                <action android:name="android.intent.action.VIEW"/>

                <category android:name="android.intent.category.BROWSABLE"/>

                <data android:mimeType="text/plain"/>
                <data
                        android:host="example.com"
                        android:scheme="https"/>
            </intent-filter>
        </activity>

Solved after
With this declaration in the manifest, the app is installed but the app icon is not installed, regardless application attributes icon and roundicon are correct or not.

Action Main need to be on its own xml element like this:

 <activity android:name=".MainActivity"
                  android:launchMode= "singleTask"
                  android:screenOrientation="portrait"
                  android:theme="@style/AppThemeHome">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <category android:name="android.intent.category.DEFAULT"/>

                <action android:name="android.intent.action.VIEW"/>

                <category android:name="android.intent.category.BROWSABLE"/>

                <data android:mimeType="text/plain"/>
                <data
                        android:host="example.com"
                        android:scheme="https"/>
            </intent-filter>
</activity>

Popular Posts