android 8.0 only fullscreen opaque activities can request orientation

08-29 16:46:32.282 17040-17040/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.demo.androidAppdemo, PID: 17040
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.demo.androidAppdemo/com.example.demo.androidAppdemo.Modules.FireBase.NotificationActivity}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3194)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3302)
        at android.app.ActivityThread.-wrap12(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)
        at android.os.Handler.dispatchMessage(Handler.java:108)
        at android.os.Looper.loop(Looper.java:166)
        at android.app.ActivityThread.main(ActivityThread.java:7425)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
     Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
        at android.app.Activity.onCreate(Activity.java:1081)
        at android.support.v4.app.SupportActivity.onCreate(SupportActivity.java:66)
        at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:321)
        at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:84)
        at com.example.demo.androidAppdemo.BaseActivity.onCreate(BaseActivity.java:93)
        at com.example.demo.androidAppdemo.Modules.FireBase.NotificationActivity.onCreate(NotificationActivity.java:87)
        at android.app.Activity.performCreate(Activity.java:7372)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3147)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3302)
        at android.app.ActivityThread.-wrap12(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)
        at android.os.Handler.dispatchMessage(Handler.java:108)
        at android.os.Looper.loop(Looper.java:166)
        at android.app.ActivityThread.main(ActivityThread.java:7425)
        at java.lang.reflect.Method.invoke(Native Method)
android.app.ActivityThread.main (ActivityThread.java:7425)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:245)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:921)
I used MainActivity to list notifications in Fragment and if a notification is clicked then the full screen transparent NotificationActivity opens with image and detail. I found crash on Android Oreo Honor device while opening NotificaionActivity.
<activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:theme="@style/AppThemeHome"/>
        <activity

<activity
            android:name=".Modules.NotificationActivity"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.Translucent"/>
Also, setting screen-orientation parameter programmatically in transparent activity not worked.
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
if an Activity is fullscreen translucent activity. there is no need to set the screen orientation lock. Screen orientation of translucent or floating activity is relied on background Activity().
You Need to make changes to your AndroidManifest.xml file
Either set the screen-orientation parameter of the NotificationActivity to "unspecified" or remove the screen-orientation parameter then it worked for me. Application not crashing and Transparent Activity(NotificationActivity) maintaining the portrait mode despite the auto-rotate on all devices (I have tested this on HTC(Android-4.3.4), Mi note 3 (Android-M) and Honour device(Android 8.0)).
<activity
            android:name=".Modules.NotificationActivity"
            android:screenOrientation="unspecified"
            android:theme="@style/Theme.AppCompat.Translucent"/>
After the above change to NotificationActivity. It's transparent and full screen. 

Android Volley Error: Fatal Exception: java.lang.NegativeArraySizeException

I got this crash in my release app on Crashlytics while using volley version 1.1.0
ANDROID ERROR CRASHLYTICS LOG:
DiskBasedCache (.java )
#343com.android.volley.toolbox.DiskBasedCache.get
Fatal Exception: java.lang.NegativeArraySizeException
-1207
    com.android.volley.toolbox.DiskBasedCache.get (Unknown Source)
    com.android.volley.toolbox.DiskBasedCache.get (Unknown Source)
    com.android.volley.CacheDispatcher.run (Unknown Source)
So, I searched for solution related to exception in DiskBasedCache class of volley and I come across below a very useful post. For more: Out of memory with Volley 1.1.0 #127

It suggest to Update the volley gradle version to latest 1.1.1.
SOLUTION CODE:
dependencies {
    ...
    //compile 'com.android.volley:volley:1.1.0'
    compile 'com.android.volley:volley:1.1.1'
}

Android- Unable to add window -- token is not valid; is your activity running

Fatal Exception: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@4272a800 is not valid; is your activity running?
       at android.view.ViewRootImpl.setView(ViewRootImpl.java:697)
       at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:342)
       at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
       at android.widget.Toast$TN.handleShow(Toast.java:459)
       at android.widget.Toast$TN$2.handleMessage(Toast.java:342)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6165)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
This crash happens when an background thread completes its processing and trying to show dialog at the same time the context(Activity) is finishing or destroying. For example if Activity is being destroyed while user presses back button and at the same time dialog.show() called then, the dialog will not find any context as activity not available and app crashes. You should wrap .show() calls in a try/catch anyhow which handles the BadTokenException.
try {
        alertDialog.show()
    }
catch (WindowManager.BadTokenException e) {
     e.printStackTrace();
    }
From (Fabric)Crash-analytics I found the Crash Details:
This crash is usually caused by your app trying to display a dialog using a previously-finished Activity as a context. For example, this can happen if an Activity triggers an AsyncTask that tries to display a dialog when it is finished, but the user navigates back from the Activity before the task is completed.

Put the dialog.show( ) in the if condition as below::
if(!((Activity) context).isFinishing())
{
    //show dialog
}

For more: Error : BinderProxy@45d459c0 is not valid; is your activity running?  
    Android – Displaying Dialogs From Background Threads

Android Error:Aapt2Exception: AAPT2 error: check logs for details

Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

error: invalid parent reference 'style/TextAppearance.AppCompat.Widget.ActionBar.Title'.
Message{kind=ERROR, text=error: invalid parent reference 'style/TextAppearance.AppCompat.Widget.ActionBar.Title'., sources=[/home/espl/A_temp_proj_hack/DemoApp/app/src/main/res/values/styles.xml:204:5-207:13], original message=, tool name=Optional.of(AAPT)}
Below is the code in my AndroidManifest.xml file where i found error related to style tag for parent parameter.
 <style name="MyActionBar.MenuTextStyle" parent="style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/white</item>
        <item name="android:textSize">15sp</item>
    </style>

Replace the style tag with @style in AndroidManifest.xml.
after change::
 <style name="MyActionBar.MenuTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/white</item>
        <item name="android:textSize">15sp</item>
    </style>
I come accross this error of mispalced intent-filter tag outside the activty while updating gradle plugin from(2.2.3) to latest android plugin(3.1.4). Intent-filter tag decleration outside of the activity or service tag causes "error: unknown element <intent-filter> found."
Message{kind=ERROR, text=error: unknown element <intent-filter> found., sources=[/home/espl/A_temp_proj_hack/DemoApp/app/build/intermediates/manifests/full/release/AndroidManifest.xml:180], original message=, tool name=Optional.of(AAPT)}
So to remove such error either comment the whole tag or place it inside corresponding activity/service tag decleration. AAPT2 doen't allows misplaced tags.

Some similar AAPT2 errors related to manifest and resource file are listed below:
AndroidManifest.xml:15: error: unknown element <action> found.

Error: style attribute 'attr/attr/my_attr (aka my.package:attr/attr/my_attr)'
not found.

Error: (...) invalid resource type 'attr' for parent of style
Previous versions of AAPT would simply ignore the misplaced tag. However, with new AAPT (AAPT2) now throws an error on this due to Behavior changes when using AAPT2

For more read this: Android Studio 3.0 Manifest Error: unknown element <action> found

android System.err: java.lang.RuntimeException: Missing type parameter

08-16 14:10:37.319 10175-10175/com.example.DemoApp W/System.err: java.lang.RuntimeException: Missing type parameter.
        at bji.getSuperclassTypeParameter(Unknown Source)
at com.example.DemoApp.V2.Home.tabfragments.HomeFragment$3.<init>(Unknown Source)
        at com.example.DemoApp.V2.Home.tabfragments.HomeFragment.setFunction(Unknown Source)
08-16 14:26:11.388 11071-11071/com.example.DemoApp W/System.err:     at com.example.DemoApp.V2.Home.tabfragments.HomeFragment.onCreateView(Unknown Source)
        at android.support.v4.app.Fragment.performCreateView(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.moveToState(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.moveToState(Unknown Source)
08-16 14:26:11.390 11071-11071/com.example.DemoApp W/System.err:     at android.support.v4.app.BackStackRecord.executeOps(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.executeOps(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.execPendingActions(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(Unknown Source)
08-16 14:26:11.391 11071-11071/com.example.DemoApp W/System.err:     at android.support.v4.app.FragmentController.dispatchActivityCreated(Unknown Source)
08-16 14:26:11.391 11071-11071/com.example.DemoApp W/System.err:     at android.support.v4.app.FragmentActivity.onStart(Unknown Source)
        at android.support.v7.app.AppCompatActivity.onStart(Unknown Source)
        at com.example.DemoApp.MainActivity.onStart(Unknown Source)
08-16 14:26:11.392 11071-11071/com.example.DemoApp W/System.err:     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1174)
        at android.app.Activity.performStart(Activity.java:5353)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2340)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2429)
08-16 14:26:11.393 11071-11071/com.example.DemoApp W/System.err:     at android.app.ActivityThread.access$800(ActivityThread.java:151)
08-16 14:26:11.394 11071-11071/com.example.DemoApp W/System.err:     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)
08-16 14:26:11.395 11071-11071/com.example.DemoApp W/System.err:     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)
Solution for above error while generating signed APK is to Add following to your proguard-rules.pro

##---------------Begin: proguard configuration for Gson  ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

##---------------End: proguard configuration for Gson  ----------

Attempt to invoke virtual method 'boolean android.widget.Editor$SelectionModifierCursorController.isDragAcceleratorActive()' on a null object reference

# OS Version: 7.0
# Device: SM-J730GM

         Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.widget.Editor$SelectionModifierCursorController.isDragAcceleratorActive()' on a null object reference
       at android.widget.Editor.updateFloatingToolbarVisibility(Editor.java:1561)
       at android.widget.Editor.onTouchEvent(Editor.java:1507)
       at android.widget.TextView.onTouchEvent(TextView.java:10071)
       at android.view.View.dispatchTouchEvent(View.java:10779)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2549)
       at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:609)
       at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1890)
       at android.app.Activity.dispatchTouchEvent(Activity.java:3240)
       at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(Unknown Source)
       at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(Unknown Source)
       at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:571)
       at android.view.View.dispatchPointerEvent(View.java:11008)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5155)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5007)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4532)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4585)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4551)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4684)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4559)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4741)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4532)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4585)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4551)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4559)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4532)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7092)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7024)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6985)
       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7202)
       at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:323)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:6776)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
    

how to fix white screen on app start up android

My android app displays white screen on start up as shown below in gif image 1. Here, by default property android:windowDisablePreview is false.

 gif image 1. - 
white screen on app start up android  for 1sec
after adding custom style to Splashactivity

TO Disable the Preview Window in Android need to add style to your Splashactivity.

Add style element to your styles.xml
<style name="AppThemeHome" parent="Theme.AppCompat.Light">
        <item name="windowNoTitle">true</item>
        <item name="android:windowDisablePreview">true</item>
</style>

then, add it as your custom style to AndroidManifest.xml as shown below
<activity android:name=".SplashActivity"
            android:theme="@style/AppThemeHome">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
</activity>
                                    

Android 8.0:java.lang.IllegalStateException:Not allowed to start service Intent

java.lang.RuntimeException: Unable to start receiver com.myapp.alarm.AlarmReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com..myapp/.alarm.AlarmSchedulingService (has extras) }: app is in background uid UidRecord{6603235 u0a81 RCVR bg:+2m0s921ms idle change:uncached procs:1 seq(0,0,0)}
IntentService is a service with more Background Execution Limits targeting Android 8.0 and higher. Android Oreo background services has introduces new Background Service Limitations. Many apps with Android Oreo that uses IntentService do not work properly.
So, to implement the same background service functionality for Android Oreo we go with JobIntentService. JobIntentService class introduces in Android Support Library 26.1.0, has same functionality as IntentService. JobIntentService when running on Android oreo and higher versions uses jobs instead of services.
For more visit Background Execution Limits

Below is the implementation of Android 8.0 JobIntentService instead of InentService example and how to use it.
# Use AlarmSchedulingService(JobIntentService class) in class AlarmManager which extends WakefulBroadcastReceiver
Intent intent= new Intent(context, AlarmSchedulingService.class);

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
 enqueueWork(context, AlarmSchedulingService.class, JOB_ID, intent);
}else{
startWakefulService(context, intent);
}

# AlarmSchedulingService.java (JobIntentService class)
//Implementation of a JobIntentService Example.
public class AlarmSchedulingService extends JobIntentService {
    //Unique job ID
    static final int JOB_ID = 1000;

    //a method to enqueue work in to this service.
    static void enqueueWork(Context context, Intent work) {
        enqueueWork(context, AlarmSchedulingService .class, JOB_ID, work);
    }

    //Handles the intent
    @Override
    protected void onHandleWork(Intent intent) {
       // We have received work to do.
       // The system already holding a wake lock at this point.
// your task code  (or function call)
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}


#Old Intent service code for Android version lower than Oreo
public class AlarmSchedulingService extends IntentService {

public AlarmSchedulingService() {
        super("AlarmSchedulingService");
    }

@Override
    protected void onHandleIntent(Intent intent) {
// your task code  (or function call)
    } }

#Use AlarmSchedulingService in class AlarmManager which extends WakefulBroadcastReceiver
Intent service = new Intent(context, AlarmSchedulingService.class);
startWakefulService(context, service);

java.lang.IllegalArgumentException: Stack size becomes negative after instruction

Exception while processing task java.io.IOException: java.lang.IllegalArgumentException: Stack size becomes negative after instruction [23] invokestatic #46 in [com/google/android/gms/internal/ads/zzap.zzf(Ljava/lang/String;)J]
After updating Google Play Services to 15.0.1(latest) from 12.0.1 my release builds stop working.
I come across the above Proguard error after updated the gms library gradle versions as follows:
1 //    compile 'com.google.android.gms:play-services-ads:12.0.1'
    compile 'com.google.android.gms:play-services-ads:15.0.1'

2  //    compile 'com.google.android.gms:play-services-analytics:12.0.1'
    compile 'com.google.android.gms:play-services-analytics:16.0.1'

3   //    compile 'com.google.android.gms:play-services-auth:12.0.1'
    compile 'com.google.android.gms:play-services-auth:15.0.1'

4  //    compile 'com.google.android.gms:play-services-gcm:12.0.1'
    compile 'com.google.android.gms:play-services-gcm:15.0.1'

Solution for above error while generating signed APK is to Add following to your proguard-rules.pro
-keep class com.google.android.gms.internal.** { *; }

Android remove log in release

Follow below steps while using proguard android to remove log

Function format and meaning of the android console log are as below:

Log.e(String, String) (error)
Log.w(String, String) (warning)
Log.i(String, String) (information)
Log.d(String, String) (debug)
Log.v(String, String) (verbose)


1) Add following to your proguard-rules.pro file to remove android log

# Remove all log android
-assumenosideeffects class android.util.Log {
    public static *** e(...);
    public static *** w(...);
    public static *** wtf(...);
    public static *** d(...);
    public static *** v(...);
    public static *** i(...);
}



2) To remove log android release use build.gradle (Module: app) file section buildTypes =>release

set minifyEnabled true
proguardFiles  - set proguard file


buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

Program type already present: android.support.design.widget.CoordinatorLayout

Program type already present:
android.support.design.widget.CoordinatorLayout$ViewElevationComparator
Message{kind=ERROR, text=Program type already present:
android.support.design.widget.CoordinatorLayout$ViewElevationComparator,
sources=[Unknown source file], tool name=Optional.of(D8)}

ANDROID ERROR- Firebase Crashlytics found an invalid API key: null


after adding file fabric.properties, getting error as below.
Crashlytics found an invalid API key: null. Check the Crashlytics plugin to make sure that the application has been added successfully! Contact support@fabric.io for assistance.

We need to register app and verify SHA-1 for same.
Add firebase: add google-services.json file from firebase console to your /app folder of your application(follow steps given by Firebase Console-> Add Firebase to your Android app ).
It's not giving error now.

( So, after adding the ApiKey for crashanalytics,
How can a firebase server verify that the crashanalytics key used by your app?
So, after you add  the firebase api key as above, the firebase server will be able to verify your app based on the google-services.json (SHA-1 verification))

For more: ERROR - Crashlytics Developer Tools error

Error:Execution failed for task ':app:preDebugAndroidTestBuild'.

Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
>Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ.
See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details. To solve this I included the force usage for support annotations in my test app, since it is internally used by runner module.


how to download an image into a bitmap using the glide library in android

Glide.with(CurrentContext)
.load("url to image online saved")
.asBitmap()
.into(new SimpleTarget() {
@Override
public void onResourceReady(Bitmap retrivedbitmap, GlideAnimation glideAnimation) {
MyBitmapObj=bitmap;
}
});


 How does one use glide to download an image into a bitmap? 

hide and show text division in Blogger post on button click

We are going to see how to hide the text on the click of button and show again on another click.

First take a example of the MCQ question shown below in image. This question at end has the button which show/hide the answer based on the current visibility of answer text:

image not available try demo

Steps to use the demo for the hide/show text::
1) create new post
2) select HTML from the Compose/HTML button on top left of the toolbar of the blog
and delete default text on that page.
3) copy code given below
4) Test the hide/show text  after publishing /updating the page to blogger.
5) View updated page in browser and you can see the working demo.

Below is the code you need to copy paste to new blogger post:

code starts after this line
<div dir="ltr" style="text-align: left;" trbidi="on">
<b>here we have an exampe to hide and show the answer of the below question:</b><br />
<b><br /></b>

<b>Question: What is the color of sky:</b><br />
<div>
<b>(1) Purple</b></div>
<div>
<b>(2) Orange</b></div>
<div>
<b>(3) Green</b></div>
<div>
<b>(4) Blue&nbsp;</b></div>
<b><br /></b>

<!--(this is comment) here, this button below hide/show text on click, we are passing id of the division ("hideshow") to hide/show the content of division -->
<button onclick="if(document.getElementById('hideshow').style.display=='none') {
                                         document.getElementById('hideshow').style.display=''
                                                         }else{
                                     document.getElementById('hideshow').style.display='none'}" title="Show/hide content" type="button"><b>Show/hide Answer</b></button>
<br />
<!--(this is comment) here, on button click event, the state of the text will change as we are passing the id of the division we want to hide or show -->

<br />
<div id="hideshow" style="display: none;">
Correct answer is option - (4) Blue </div>
</div>

code ends before this line

hide and show text in Blogger on button click example

here we have an exampe to hide and show the answer of the below question:

Question: What is the color of sky:
(1) Purple
(2) Orange
(3) Green
(4) Blue 



Top 10 augmented reality sdks for developers

AR SDK in Android


Some Important links:

DSK Name
API/SDK Type
Compatibility Android versions
GitHub URL/ SDK URL
Applications

Wikitude
JavaScript and Native API
NA

- Instant Tracking
- Plane Detection
- SMART support (ARCore / ARKit)
- Hit-Testing API
Offline 3D Object/Scene Recognition & Tracking
- Offline/Cloud 2D Image Recognition & Tracking
- Multiple Image Targets
- Extended Tracking
- Save & Load Instant Target

Google ARCore
SDK and NDK
Android 7.0 and higher

Motion tracking
Environmental understanding
Light estimation

Vuforia (QUALCOMM)
JAR(SDK)

source code and explore Vuforia
- Recognition of the different types of visual objects (a box, cylinder, plane), text and
- environments recognition, VuMark (a combination of picture and QR-code).

EasyAR
SDK(JAR) + 2 .so files for ARM and other processor...
NA
Website:
Basic:
AR with planar target, smooth loading and recognition for more than 1000 local targets, video and transparent video playback based on HW codecs, QR code recognition, and multi-target tracking.

PRO::
- SLAM 3D Object Tracking
- Multi type of target
- simultaneous detection and
- Tracking Screen Recording
Note: Free trial only supports up to 100 times uses per day

(EasyAR SDK Pro $499.00/License Key)
Kudan
AR SDK
NA
Web:
- supports both marker-based and markerless tracking, which is great for AR
- developers who need to create functionality without marker based initialization.
How to download SDK??

Free:  Validity(1 Year No one time fee)

AR Business :  £1,000 /year
MAXST AR
(JAR)SDK + .so files...


License and Price list: https://developer.maxst.com/Pricing
Image Tracker, Visual SLAM (Simultaneous localization and mapping), and Object Tracker
- LICENSE TYPE Free (Watermark) -- Non-commercial use only
DeepAR


DeepAR Realtime Face Detection

Snapchat and Facebook style 3D and realistic face lenses, masks and special FX to iOS, Android, HTML5 and Unity applications.

Xzimg
NA
NA
Web:
Augmented Reality Magic Face Filters Deep Learning Vision at Your Service

Pikkart AR SDK
AAR files (SDK)
NA
Image recognition, AR Logo, Cloud recognition, Geo augmented marker


Popular Posts