Most Important Android Studio Apps Error Solution 2020 - ILOVEDESHI

Contact us for Android Apps Making And Android Apps Solution All Services are paid. Here are the some Most Important Android Studio Apps Error Solution is given by ilovedeshi.com

Most Important Android Studio Apps Error Solution 2020 - ILOVEDESHI
Hi Friends, This is Vinod, Today I'll show you how to overcome the most important android studio apps error... Many users message me and asking sir how to solve these errors, so today I'll give you a complete solution to some major problems. So let's get started...
  1. Cleartext traffic not permitted: Android Studio - 2020

This is a common problem today's android studio apps because 80% of apps are handled using Admin Server or Panel. So when we call or add external URL and use its API then this error will overcome, so you can easily short out it. Just Follow as shown below.
Starting with Android 9 (API level 28), cleartext support is disabled by default.
Option 1 -
Create file res/xml/network_security_config.xml -
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">domain.com (to be adjusted)</domain>
    </domain-config>
</network-security-config>
AndroidManifest.xml -
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:networkSecurityConfig="@xml/network_security_config"
        ...>
        ...
    </application>
</manifest>
Option 2 -
AndroidManifest.xml -
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:usesCleartextTraffic="true"
        ...>
        ...
    </application>
</manifest>
Option 3 -
 
If you have android:targetSandboxVersion in <manifest> then reduce it to 1
AndroidManifest.xml -
<?xml version="1.0" encoding="utf-8"?>
<manifest android:targetSandboxVersion="1">
    <uses-permission android:name="android.permission.INTERNET" />
    ...
</manifest>
 
  • Permission Denial: startForeground requires android.permission.FOREGROUND_SERVICE

This will happen if you have set targetSdkVersion = 28 (Android 9 / Pie) or above and have not declared the usage of the FOREGROUND_SERVICE permission.
FOREGROUND_SERVICE is normal permission, so the system automatically grants it to the requesting app.
The solution is to just add the following in AndroidManifest.xml:
<manifest ...>
     ...
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
     ...
     <application ...>
     ...
</manifest>
  • WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with [closed]

To determine what is calling variant.getMergeResources(), use -
Pandroid.debug.obsoleteApi=true
on the command line to display more information. Affected Modules: app
there is no permanent solution for that as of now. It's a warning that you should be able to safely ignore for now.
  • Crash on setOnTabSelectedListener with com.android.support:design:28.0.0

You should use the new Material Components dependencies. With this one, everything works fine and you just need to add one line in Gradle to import all design components.
implementation 'com.google.android.material:material:1.0.0'
And Just Change .setOnSelectedListner With .addOnTabSelectedListener
tablayout.addOnTabSelectedListener
(new TabLayout.ViewPagerOnTabSelectedListener(viewPager));
viewPager.addOnPageChangeListener
(new TabLayout.TabLayoutOnPageChangeListener(tablayout));
Remember that: You should not use the com.android.support and com.google.android.material dependencies in your app at the same time.
  • How to optimize gradle build performance regarding build duration and RAM usage?

You need to give more memory to the Gradle JVM, not to the compile task/JVM. One way to do so is via the GRADLE_OPTS environment variable (GRADLE_OPTS=-Xmx512m).
Added the below mentioned two Environment Variables and solved this issue-
Variable Name: GRADLE_OPTS
Variable Value: -Xmx512m

Variable Name: JAVA_OPTS
Variable Value: -Xmx512m
In the gradle.properties file add the following line: This will boost the build - taken from
org.gradle.daemon=true
  • NoClassDefFoundError: org/apache/commons/logging/LogFactory

Add this inside your Application in the App manifest
<uses-library
            android:name="org.apache.http.legacy"
            android:required="false"/>
  • And Sometimes Play Store Shows Error During App Upload Which is > The ARCore dependency type com.google.ar.core is missing from the AndroidManifest.xml file, although the meta-data tag com.google.ar.core.min_apk_version has been specified.

Prerequisites

Note that ARCore support requires Android build Tools 26.0.2; these instructions have been tested against Android Studio 3.0.1 and Gradle 4.6.

Enabling ARCore

  • Edit AndroidManifest.xml and add the following within the <application> element:
<!-- The following must be present to facilitate use of ARCore, if available -->
<meta-data android:name="com.google.ar.core" android:value="optional" />
Edit (root) build.gradle and ensure that each of the repositories elements include an entry for google():
repositories {
    jcenter()
    google()
}
Also in (root) build.gradle, ensure that the dependencies element references the 3.0.1 gradle tools:
classpath 'com.android.tools.build:gradle:3.0.1
Edit app/build.gradle and confirm that the dependencies element references the ARCore client library:
dependencies {
    implementation 'com.google.ar:core:1.4.0'
}
  • How to Enable virtualization on your computer or laptop in any window.

To access the BIOS, most computers offer a prompt to press a button/button combination to ‘enter setup’ in the first few seconds after turning on your computer. You will need to do this before your operating system begins to load. On some machines, this button/button combination will take you directly to the BIOS settings, on other machines you may encounter a ‘Setup Menu’ which will include an option to enter the BIOS.
If your computer doesn’t offer any options to access its BIOS before your OS loads then it is possible that it uses UEFI instead. Please read further on in this article for information on accessing your computer’s UEFI.
Below is a list of the most common computer manufacturers and information regarding accessing the BIOS settings for each manufacturer.

Acer

Most commonly: F2 or Delete.
On older computers: F1 or the key combination CTRL+ALT+ESC.
  1. Turn ON the System.
  2. Press F2 key at startup BIOS Setup.
  3. Press the right arrow key to System Configuration tab, Select Virtualization Technology and then press the Enter key.
  4. Select Enabled and press the Enter key.
  5. Press the F10 key and select Yes and press the Enter key to save changes and Reboot into Windows.

Asus

Most commonly: F2.
Alternatively: Delete or Insert key, and less commonly F10.
  1. Turn ON the System.
  2. Press F2 key at startup BIOS Setup.
  3. Press the right arrow key to Advanced tab, Select Virtualization Technology and then press the Enter key.
  4. Select Enabled and press the Enter key.
  5. Press the F10 key and select Yes and press the Enter key to save changes and Reboot into Windows.

DELL

Newer models: F2 key whilst Dell logo is on screen.
Alternatively: F1, Delete, F12, or F3.
Older models: CTRL+ALT+ENTER or Delete or Fn+ESC or Fn+F1.
  1. Turn ON the System.
  2. Press F2 key at startup BIOS Setup.
  3. Press the right arrow key to Advanced tab, Select Virtualization and then press the Enter key.
  4. Select Enabled and press the Enter key.
  5. Press the F10 key and select Yes and press the Enter key to save changes and Reboot into Windows.

HP

Most commonly: F10 or ESC.
Alternatively: F1, F2, F6, or F11
On HP Tablet PCs:  F10 or F12
  1. Turn ON the System
  2. Repeatedly press Esc key at startup.
  3. Press the F10 key for BIOS Setup.
  4. Press the right arrow key to System Configuration tab, Select Virtualization Technology and then press the Enter key.
  5. Select Enabled and press the Enter key.
  6. Press the F10 key and select Yes and press the Enter key to save changes and Reboot.

Lenovo

Most commonly: F1 or F2
Older hardware: the key combination CTRL+ALT+F3 or CTRL+ALT+INS or Fn+F1.

Enabling VT-x in ThinkPad (Tablets/Convertibles/Notebooks):

  1. Power ON the system.
  2. Press Enter or Tap the touch screen during the Lenovo startup screen.
  3. Press or Tap F1to enter into BIOS Setup.
  4. Navigate to the Security tab, then press Enter on Virtualization.
  5. Select Intel(R) Virtualization Technology, Press Enter, choose Enable and press Enter.
  6. Press F10.
  7. Press Enter on YES to save the settings and boot into Windows.

Enabling VT-x in ThinkCentre (Desktops):

  1. Power ON the system.
  2. Press Enter during Lenovo startup screen.
  3. Press F1key to enter into BIOS Setup.
  4. Navigate to the Advanced tab and press Enter on CPU Setup.
  5. SelectIntel(R) Virtualization Technology, Press Enter, choose Enable and press Enter.
  6. Press F10.
  7. Press Enter on YES to save the settings and boot into Windows.

Sony

Sony VAIO:  F2 or F3
Alternatively: F1
If your VAIO has an ASSIST key, try to press and hold it while you power on the laptop. This also works if your Sony VAIO came with Windows 8.
  1. With the computer turned completely off, press and hold the Assist button until the black VAIO screen appears. NOTE: The location of the Assist button will be different depending on the computer model. Refer to the operating instructions supplied with the computer for the exact location of the Assist button on your model.
  2. At the VAIOCare | Rescue Mode screen, press the Down Arrow key until the Start BIOS setup [F2] option is highlighted, and then press the Enter key.
  3. In the [BIOS Name] Setup Utility screen, press the right-arrow key until the Advanced tab is selected.
  4. On the Advanced tab, press the down-arrow key until Intel(R) Virtualization Technology is selected and then press the Enter key. 
  5. Use the arrow keys to select Enabled, and then press the Enter key.
  6. Press the right-arrow key until the Exit tab is selected.
  7. Press the down-arrow key until Exit Setup is selected and then press the Enter key.
  8. In the Save screen, verify Yes is selected and then press the Enter key.

Toshiba

Most commonly: F2 key.
Alternatively: F1 and ESC.
Toshiba Equium: F12
  1. Turn ON the System.
  2. Press F2 key at startup BIOS Setup.
  3. Press the right arrow key to Advanced tab, Select Virtualization Technology and then press the Enter key.
  4. Select Enabled and press the Enter key.
  5. Press the F10 key and select Yes and press the Enter key to save changes and Reboot into Windows.
As mentioned, the steps required to enable virtualization may differ from the above, depending on the BIOS version of your machine. If this is the case, then you should look for options labeled 'Virtualization Technology' or 'Intel® Virtualization Technology' under the 'CPU Configurations', 'System Configurations', 'Advanced', 'Security' or  'Processor' tab and check if the option is enabled or disabled. Less commonly, you may find the settings within the 'Chipset' or 'Northbridge' or BIOS specific overclocking tab.
If you have enabled these settings within the BIOS or, having enabled them, you are still seeing error messages from your virtualization software referencing VT-X or AMD-V, then it may be necessary to disable Hyper-V on your computer. This can be done as follows:

Go to Control Panel -> Programs -> Programs and Features -> click Turn Windows features on or off -> un-check Hyper-V -> click OK.