java.lang.IllegalArgumentException: Error: Failed to parse APK file: - android

I have search stockoverflow and google with no luck. I recently migrated my app to androidx, after a lot of effort I was able to fix all the build fails. but now I am getting the following error when the app is installing on the emulator or the device. any help will be highly appreciated.
I have tried the following:
invalidate caches/restart
clean build and rebuild project
uninstalled app from the device
restarted my pc
Exception occurred while executing:
java.lang.IllegalArgumentException: Error: Failed to parse APK file: /data/local/tmp/...
at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:338)
at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:906)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:158)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21328)
at android.os.Binder.shellCommand(Binder.java:634)
at android.os.Binder.onTransact(Binder.java:532)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2821)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3856)
at android.os.Binder.execTransact(Binder.java:731)
Caused by: android.content.pm.PackageParser$PackageParserException: Failed to parse /data/local/tmp/...
at android.content.pm.PackageParser.parseApkLiteInner(PackageParser.java:1590)
at android.content.pm.PackageParser.parseApkLite(PackageParser.java:1575)
at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:331)
... 9 more
$ adb shell pm uninstall ...
Unknown failure (at android.os.Binder.execTransact(Binder.java:731))
Error while Installing APK

Delete the previous app-release.apk file from the android folder:
\app\build\outputs\apk\release
Then clear all data from the emulator. Finally, rebuild the application.

Clean -> Rebuild -> and try to check both v1 and v2 while generating apk file

You should drop the cache on your mobile.
for example:
1- open your windows terminal on your computer
2 - enter the command >adb shell
you should be insite on your mobile
3 - enter to the tmp/appium_cache/ folder with >cd data/local/tmp/appium_cache
4 - write the command >ls to see all the elements that there is insite of that folder
5 - drop all that elements with the command >rm filename
hope to help you

just delete build folder and run again
android/app/build

Related

stuck on creating 'moor_database.g.dart'

I wanted to generate file 'moor_database.g.dart' by typing the command 'flutter packages pub run build_runner watch' but after doing some procedures it just tells: [INFO] Succeeded after 9.0s with 0 outputs (4 actions)
And inside the terminal results I saw this warning:
[WARNING] moor_generator:moor_generator on lib/data/moor.dart: Missing "part 'moor.g.dart';".
I had this message because I had my own file called moor.dart which conflicted with the moor library file (that's why that command was not working properly) but Android Studio didn't give any direct errors or warning on that, after renaming my file name, everything worked

LLVM: commnad not found llvm-readobj

While trying to build sample qt app for android, stuck with below errors.
Command does not exist:
/Users/sungyong/Library/Android/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readobj
Command does not exist:
/Users/sungyong/Library/Android/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readobj
Command does not exist:
/Users/sungyong/Library/Android/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readobj
Command does not exist:
/Users/sungyong/Library/Android/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readobj
Command does not exist:
/Users/sungyong/Library/Android/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readobj
Command does not exist:
/Users/sungyong/Library/Android/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readobj
Command does not exist:
/Users/sungyong/Library/Android/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-strip
11:26:20: The process
"/Users/sungyong/Qt/5.12.2/android_arm64_v8a/bin/androiddeployqt"
exited with code 9. Error while building/deploying project qtempty
(kit: Android for arm64-v8a (Clang Qt 5.12.2 for Android ARM64-v8a))
When executing step "Build Android APK"
Even though googling correct solution, still have no idea.
What do I check?
There's is no 'llvm-readobj' at this path even though I follow guide.
I've also encountered a similar problem.
The error message was llvm-strip:not found, despite having clang-10 on my Ubuntu system.
But I found llvm-strip-10 in directory /usr/bin, it's not llvm-strip.
So I made soft link llvm-strip --> llvm-strip-10 and it works.
Presumably you need to update your NDK. It's there in a current release.

Error at installing my app on mobile for testing

my package name is com.example.project name but to upload it on google console for publishing it.I change it to com.ahsan.project name, now when i am trying to run it on my mobile it is showing me this error....
already have tried to revert back to old changes but it is not working.still getting the same result.
Run Window
Unknown failure: Exception occurred while executing:
java.lang.IllegalArgumentException: Unknown package: com.example.ethlon
at com.android.server.pm.Settings.getInstallerPackageNameLPr(Settings.java:5051)
at com.android.server.pm.PackageManagerService.getInstallerPackageName(PackageManagerService.java:27786)
at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:27792)
at com.android.server.pm.PackageManagerService.deletePackageVersioned(PackageManagerService.java:23919)
at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:993)
at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:912)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:134)
at android.os.ShellCommand.exec(ShellCommand.java:96)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:28572)
at android.os.Binder.shellCommand(Binder.java:581)
at android.os.Binder.onTransact(Binder.java:481)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:3209)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:5078)
at android.os.Binder.execTransact(Binder.java:682)
Error while Installing APKs
this error happen because
your package name not the same in all project
search and update your package to be the same
Most of the time this error came due to Changes in file location in Project folder.
To solve this problem you just have to open whole project again as a new Project.
Steps-
File-Export To Zip File (save as new zip file).
Unzip the zip file.
Go to Open and select the location of unzip file.
Now try to run app on device.

Jenkins unable to locate files on my computer

when ever I try to build my android project on jenkins it fails by saying :
Started by user anonymous
Building in workspace /home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2
[mysteryshopper_version2] $ ant -Dlabel=trial1-9 clean debug
Buildfile: /home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2/build.xml
BUILD FAILED
/home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2/build.xml:90: Cannot find /home/tanzeelrana/android-sdk-linux/tools/ant/build.xml imported from /home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2/build.xml
Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
on line 90 in my build.xml file I have a tag with the following in it :
import file="/home/tanzeelrana/android-sdk-linux/tools/ant/build.xml"
does anyone know why it is unable to locate this file ? the file exist at the exact path ....
Jenkins usually runs with its own user (jenkins),
so it is probably an issue of permissions.
Try printing the current user from within your Jenkins job.
EDIT:
See here about running Jenkins as a daemon -
it also shows how to set it to run as a different user than 'jenkins':
Installing Jenkins as a Unix daemon

Jenkins-CI SCP Plugin cannot find files to upload

I have Jenkins-CI compiling an Android app I'm working on. Compiles it great but it will not upload the release apk via SCP. I have set the source to bin/* and it gives me the following error. Does anyone have a suggestion on what I have configured wrong? I've had it working in the past, but I forgot to get the config before I re-installed Fedora on the machine.
[SCP] Connecting to smccloud.com
ERROR: Failed to upload files
2: No such file
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2289)
at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:1741)
at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:1758)
at com.jcraft.jsch.ChannelSftp.stat(ChannelSftp.java:1715)
at be.certipost.hudson.plugin.SCPSite.upload(SCPSite.java:188)
at be.certipost.hudson.plugin.SCPRepositoryPublisher.perform(SCPRepositoryPublisher.java:218)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:682)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:657)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:635)
at hudson.model.Build$RunnerImpl.post2(Build.java:161)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:604)
at hudson.model.Run.run(Run.java:1400)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:175)
Build step 'Publish artifacts to SCP Repository' changed build result to UNSTABLE
I encountered this error when I was trying to copy to a directory that didn't exist on the target machine. Create the directory(s) on the target first and this should go away and the copy work.
On the target machine you are seeing something like:
No such file or directory
when you try to navigate to the non-existent directory.
If the plugin isn't working for you can use the shell script with expect, as a post build step, to do it for you.

Categories

Resources