sndcpy icon indicating copy to clipboard operation
sndcpy copied to clipboard

Problem with the Streamed Install

Open Alstranded opened this issue 4 years ago • 1 comments

Hi, I'm getting the following error:

Waiting for device...
Performing Streamed Install
adb: failed to install sndcpy.apk:
Exception occurred while executing 'install':
java.lang.SecurityException: You need the android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS permission to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag
        at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:613)
        at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:486)
        at com.android.server.pm.PackageManagerShellCommand.doCreateSession(PackageManagerShellCUninstalling existing version first...
Failure [DELETE_FAILED_INTERNAL_ERROR]
Failed with error #1.
Press any key to continue . . .

I have enabled the option for installing apps via USB in my phone:

image

So I don't know what could be the problem. Maybe other option I don't know that has to be enabled...

On the other hand, after reading the error, I tried installing the sndcpy.apk manually on my phone, then removing the part of the code in the bat file (I'm a windows user) that has the "ADB serial install" command, and that worked for me. I hope that anyone that has this issue can do the same, but I still hope to know how to solve the problem properly.

The lines I deleted from the file were:

%ADB% %serial% install -t -r -g %SNDCPY_APK% || (
    echo Uninstalling existing version first...
    %ADB% %serial% uninstall com.rom1v.sndcpy || goto :error
    %ADB% %serial% install -t -g %SNDCPY_APK% || goto :error
)

And my sndcpy.bat file looks like this:

@echo off
if not defined ADB set ADB=adb
if not defined VLC set VLC="C:\Program Files\VideoLAN\VLC\vlc.exe"
if not defined SNDCPY_APK set SNDCPY_APK=sndcpy.apk
if not defined SNDCPY_PORT set SNDCPY_PORT=28200

if not "%1"=="" (
    set serial=-s %1
    echo Waiting for device %1...
) else (
    echo Waiting for device...
)

%ADB% %serial% wait-for-device || goto :error
echo Install skipped
%ADB% %serial% forward tcp:%SNDCPY_PORT% localabstract:sndcpy || goto :error
%ADB% %serial% shell am start com.rom1v.sndcpy/.MainActivity || goto :error
echo Press Enter once audio capture is authorized on the device to start playing...
pause >nul
echo Playing audio...
%VLC% -Idummy --demux rawaud --network-caching=-1 --play-and-exit tcp://localhost:%SNDCPY_PORT%
goto :EOF

:error
echo Failed with error #%errorlevel%.
pause
exit /b %errorlevel%

Alstranded avatar Oct 21 '21 02:10 Alstranded

You must remove -g from the adb install command, see #39.

rom1v avatar Oct 21 '21 06:10 rom1v