Android SDK 28 – versionCode in PackageInfo has been deprecated

It says what to do on the Java doc (I recommend not using the Kotlin documentation for much; it’s not really maintained well): versionCode This field was deprecated in API level 28. Use getLongVersionCode() instead, which includes both this and the additional versionCodeMajor attribute. The version number of this package, as specified by the tag’s … Read more

Fragments deprecated in Android P

The rewrite in Support Library 27.1.0 Ian’s medium post (Feb 28, 2018) gives us an explanation about it. He is Android Framework Developer at Google. Loaders in Support Library 27.1.0 For Support Library 27.1.0, I rewrote the internals of LoaderManager, the class powering the Loaders API and I wanted to explain the reasoning behind the changes and what to expect … Read more

Android 9.0: Not allowed to start service: app is in background.. after onResume()

There is a workaround from Google: The issue has been addressed in future Android release. There is a workaround to avoid application crash. Applications can get the process state in Activity.onResume() by calling ActivityManager.getRunningAppProcesses() and avoid starting Service if the importance level is lower than ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND. If the device hasn’t fully awake, activities would be … Read more

Android design support library for API 28 (P) not working

You can either use the previous API packages version of artifacts or the new Androidx, never both. If you wanna use the previous version, replace your dependencies with dependencies { implementation fileTree(include: [‘*.jar’], dir: ‘libs’) implementation “org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version” implementation ‘com.android.support:appcompat-v7:28.0.0-alpha3’ implementation ‘com.android.support.constraint:constraint-layout:1.1.1’ testImplementation ‘junit:junit:4.12’ androidTestImplementation ‘com.android.support.test:runner:1.0.2’ androidTestImplementation ‘com.android.support.test.espresso:espresso-core:3.0.2’ implementation ‘com.android.support:design:28.0.0-alpha3’ implementation ‘com.android.support:cardview-v7:28.0.0-alpha3’ } if you want … Read more

Android P visibilityawareimagebutton.setVisibility can only be called from the same library group

Using Method 1 demoFab.show(); // in place of visible demoFab.hide(); // in place of Invisible suppress the warning/error for me. and Method 2 @SuppressLint(“RestrictedApi”) // also suppressed the warning private void setUp() { …. } update: Method 3: demoFab.setVisibility(View.GONE); demoFab.setVisibility(View.INVISIBLE); demoFab.setVisibility(View.VISIBLE); Method 4: demoFab.visibility = View.GONE demoFab.visibility = View.INVISIBLE demoFab.visibility = View.VISIBLE

How to allow all Network connection types HTTP and HTTPS in Android (9) Pie?

The easy way to implement this is to use this attribute to your AndroidManifest.xml where you allow all http for all requests: <application android:usesCleartextTraffic=”true”> </application> But in case you want some more configurations for different links for instance, allowing http for some domains but not other domains you must provide res/xml/networkSecurityConfig.xml file. To do this … Read more

java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion

Update: This is no longer a bug or a workaround, it is required if your app targets API Level 28 (Android 9.0) or above and uses the Google Maps SDK for Android 16.0.0 or below (or if your app uses the Apache HTTP Legacy library). It is now included in the official docs. The public … Read more