adb: failed to open app.apk: Operation not permitted with flutter

2.5k Views Asked by At

I am facing this issue when trying to run any flutter app on android emulator or physical device. It fails while executing adb command for installing the application.

 Error: ADB exited with exit code 1
 Performing Streamed Install
           
 adb: failed to open /Users/mohitsingh/Desktop/testapp/testapp/build/app/outputs/flutter-apk/app.apk: Operation not permitted
 Warning: Failed to install APK.

However if I run the same command manually, It fails with the same error for the first time after app is built with flutter build apk command but it is successfully installed on subsequent trials with

adb -s emulator-5554 install build/app/outputs/flutter-apk/app.apk

All other commands of adb seem to work fine. It was working fine till last week but this error started coming up suddenly with adb.

1

There are 1 best solutions below

5
Mashood .H On

Error: ADB exited with exit code 1 is a common error Here are the following solutions for that

Solution 1

add android:exported="true in your AndroidManifest.xml file

<activity android:name=".MainActivity" 
android:exported="true" 

Solution 2

Turn on Install via USB in developer mode.

run the following Command

flutter clean

flutter pub

flutter run