4

Can somebody help me please to understand this error if I try to run Android project in Android Studio + Andy emulator? Error says The application could not be installed: INSTALL_FAILED_VERIFICATION_FAILURE. Its simple application with one spinner widget. This is my MainActivity file

package camo.learn2codeproject3;


import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;
import java.util.ArrayList;


public class MainActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener
{

    Spinner spinner;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        spinner = findViewById(R.id.spinner1);

        ArrayList<String> spinnerItems = new ArrayList<>();  // Empty <> == <String>
        spinnerItems.add("bicykel");
        spinnerItems.add("auto");
        spinnerItems.add("lod");
        spinnerItems.add("padak");
        spinnerItems.add("vlak");

        ArrayAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, spinnerItems );

        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

        spinner.setAdapter(adapter);
        spinner.getOnItemSelectedListener();
    }

    @Override
    public void onItemSelected(AdapterView<?> adapter, View view, int position, long id)
    {
        String item = adapter.getItemAtPosition(position).toString();
        Toast.makeText( this, "Vybrali ste: " + item, Toast.LENGTH_LONG ).show();
    }

    @Override
    public void onNothingSelected(AdapterView<?> parent)
    {
        Toast.makeText( this, "Hey nič ste nevybrali!!!", Toast.LENGTH_LONG ).show();
    }
}

here is activity_main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <Spinner
        android:id="@+id/spinner1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />

</LinearLayout>

and here is error log

2020-04-30 21:42:01.428 4266-4266/? E/studio.deploy: Could not get package user id: run-as: Package 'camo.learn2codeproject3' is unknown
2020-04-30 21:42:01.652 4266-4266/? E/studio.deploy: Could not find apks for package: camo.learn2codeproject3
2020-04-30 21:42:03.294 3373-3373/com.android.vending I/Finsky: [1] abjv.a(7): Verification requested, id = 2
2020-04-30 21:42:03.432 3373-4253/com.android.vending I/Finsky: [212] abli.a(9): Single user settings service is not running, bind it now
2020-04-30 21:42:03.458 3373-3373/com.android.vending I/Finsky: [1] ablh.onServiceConnected(1): Single user settings service is connected
2020-04-30 21:42:03.495 3373-4253/com.android.vending W/Settings: Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
2020-04-30 21:42:03.646 4262-4262/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
2020-04-30 21:42:03.656 4262-4262/? D/AndroidRuntime: CheckJNI is OFF
2020-04-30 21:42:03.810 4262-4262/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
2020-04-30 21:42:03.841 4262-4262/? W/art: Unexpected CPU variant for X86 using defaults: x86
2020-04-30 21:42:03.841 3373-4253/com.android.vending I/Finsky: [212] lew.a(9): Task 7 requested foreground
2020-04-30 21:42:03.847 3373-4253/com.android.vending I/Finsky: [212] lew.a(22): Not entering foreground
2020-04-30 21:42:03.912 4262-4262/? E/memtrack: Couldn't load memtrack module (No such file or directory)
2020-04-30 21:42:03.913 4262-4262/? E/android.os.Debug: failed to load memtrack module: -2
2020-04-30 21:42:03.914 4262-4262/? I/Radio-JNI: register_android_hardware_Radio DONE
2020-04-30 21:42:03.945 4262-4262/? D/AndroidRuntime: Calling main entry com.android.commands.wm.Wm
2020-04-30 21:42:03.947 4262-4262/? D/AndroidRuntime: Shutting down VM
2020-04-30 21:42:03.970 4262-4293/? W/art: Thread attaching while runtime is shutting down: Binder:4262_1
2020-04-30 21:42:03.970 4262-4293/? I/AndroidRuntime: NOTE: attach of thread 'Binder:4262_1' failed
2020-04-30 21:42:04.086 3373-4171/com.android.vending I/Finsky: [207] abrq.b(3): Verify: Verification package=camo.learn2codeproject3, id=2 response=3
2020-04-30 21:42:04.096 3373-4253/com.android.vending I/Finsky: [212] abst.c(15): Verifying id=2, result=-1
2020-04-30 21:42:04.117 3373-4253/com.android.vending I/Finsky: [212] abre.a(8): Verify: Installation silently blocked. package=camo.learn2codeproject3
2020-04-30 21:42:04.161 3373-3373/com.android.vending I/Finsky: [1] abst.hp(6): Verification complete: id=2, package_name=camo.learn2codeproject3
2020-04-30 21:42:04.201 3373-3373/com.android.vending I/Finsky: [1] abnu.hp(2): Reported verification result: REJECT
2020-04-30 21:42:04.203 3373-3373/com.android.vending I/Finsky: [1] acmh.b(3): Verification stage already finished, ignoring sub-task callback
2020-04-30 21:42:04.213 3373-3373/com.android.vending I/Finsky: [1] acmh.b(3): Verification stage already finished, ignoring sub-task callback
2020-04-30 21:42:04.273 3373-3375/com.android.vending I/art: Do partial code cache collection, code=124KB, data=104KB
2020-04-30 21:42:04.281 3373-3375/com.android.vending I/art: After code cache collection, code=122KB, data=103KB
2020-04-30 21:42:04.281 3373-3375/com.android.vending I/art: Increasing code cache capacity to 512KB
2020-04-30 21:42:04.342 1616-1616/? I/audioserver: type=1400 audit(0.0:352): avc: denied { read } for scontext=u:r:audioserver:s0 tcontext=u:object_r:unlabeled:s0 tclass=socket permissive=1
2020-04-30 21:42:04.342 1616-1616/? I/audioserver: type=1400 audit(0.0:353): avc: denied { write } for scontext=u:r:audioserver:s0 tcontext=u:object_r:unlabeled:s0 tclass=socket permissive=1
2020-04-30 21:42:04.502 1993-1993/? I/logzmq: type=1400 audit(0.0:354): avc: denied { write } for scontext=u:r:goldfish_setup:s0 tcontext=u:object_r:unlabeled:s0 tclass=socket permissive=1
2020-04-30 21:42:05.251 3373-3470/com.android.vending I/Finsky: [148] ruz.d(9): Invalidating cached PackageState for web.php5.sk
2020-04-30 21:42:05.263 3373-3470/com.android.vending I/Finsky: [148] ruz.d(9): Invalidating cached PackageState for web.php5.learn2codeproject2
2020-04-30 21:42:26.865 2196-2860/system_process I/Sensors: setActive() with handle = 0, enabled = 1
2020-04-30 21:42:26.865 2196-2860/system_process I/Sensors: setDelay() with handle = 0, delay = 20000 us
2020-04-30 21:42:27.101 2196-2253/system_process W/WifiMode: AndroidWifi, Invalid SupportedRates!!!
2020-04-30 21:42:27.102 2196-2251/system_process W/WifiMode: AndroidWifi, Invalid SupportedRates!!!
2020-04-30 21:42:27.102 2196-2251/system_process W/WifiMode: AndroidWifi, Invalid SupportedRates!!!
2020-04-30 21:42:28.371 2196-2208/system_process I/Sensors: setActive() with handle = 0, enabled = 0

As I see application does not work only in Andy emulator. In my phone it works well. I am little lost in it. Thanks.

Čamo
  • 3,863
  • 13
  • 62
  • 114
  • I have not used Andy emulator but looking at the error message looks like something related to apk signature. Did you try installing a signed apk (if its possible on Andy emulator) ? – inventionsbyhamid May 08 '20 at 14:34
  • Please refer to this : [VERIFICATION_FAILURE install fail](https://stackoverflow.com/questions/15014519/apk-installation-failed-install-failed-verification-failure) – Saumya Sinha May 08 '20 at 19:16
  • Looks like the signing verification is failing. You can either go to the Andy emulator and turn off the signing verification (in settings, could be "verify apps installed over UDB") or sign the app in Android Studio before installing on Andy. – auspicious99 May 10 '20 at 02:51
  • Would you mind posting your (app module) build.gradle – Jamal S May 11 '20 at 08:12

3 Answers3

6

Disabling the Verify Apps over USB from developer settings worked for me:

Settings > Developer Options > Then Turn off Verify Apps over USB

You might need to turn on installation from unknown sources:

Settings > Security > Then Turn on Unknown sources

Note in case the option is not available you can also run adb command:

adb shell settings put global package_verifier_enable 0
Sagar
  • 23,903
  • 4
  • 62
  • 62
  • 1
    I dont understand. Today it works without any changes. But your answer have some interesting hints so I accept it. – Čamo May 12 '20 at 11:26
1

There are a few checks you can try 1st:

  1. make sure there's enough space on your emulator (remove any apps you have installed from other projects)
  2. make sure you don't have a version of the app with different signing certificate installed (like for example a debug version of the app installed and you trying to install the release variant of the app on top of it or vise versa)
  3. In Android studio terminal, Type: adb shell > Type: settings put global verifier_verify_adb_installs 0 (disables Google Play Services verify apps option)

Most of the time when testing my apps in andorid emulator i run into either issue no#1 or no#2

Jamal S
  • 1,649
  • 1
  • 19
  • 24
0

This worked for me. I had a Launcher activity with android:exported="false" in Manifest, then I changed it to android:exported="true"

Faizan Haidar Khan
  • 1,099
  • 1
  • 15
  • 20