i have errors in the flutter build apk command - android

when generating the apk through flutter I get the following warnings, the app works fine in the emulator but on the device when installing the apk, the cell phone says that an error has occurred
I hope to be able to emulate the apk correctly on the physical device.

From the command line:
Enter cd [project]
Run flutter build apk --split-per-abi
(The flutter build command defaults to --release.)
This command results in three APK files:
[project]/build/app/outputs/apk/release/app-armeabi-v7a-release.apk
[project]/build/app/outputs/apk/release/app-arm64-v8a-release.apk
[project]/build/app/outputs/apk/release/app-x86_64-release.apk
Removing the --split-per-abi flag results in a fat APK that contains your code compiled for all the target ABIs. Such APKs are larger in size than their split counterparts, causing the user to download native binaries that are not applicable to their device’s architecture.

Related

Running gradlew assembleRelease produces no output APK

Whenever I run gradlew assembleRelease either from a terminal or from within Android Studio, I see that the process ends successfully with "BUILD SUCCESSFUL". But after inspecting app\build\outputs I don't see any folder named apk.
Using the same build variant "release", the application can be installed into the device directly from Android Studio and the apk can also be successfully generated when using the "Generate Signed Bundle / APK..." option from the IDE.
I am using gradle 7.2.0.
Where should I look for to understand what is happening?
What could be causing this behavior?

How can I see what gradle task Android Studio is using to install an apk?

When I run a configuration, I can the gradle commands android studio is running to build the apk in the build tab (assembleDebug). But it is not showing me what command is run after that to actually install the apk on a device. Is there a way I can see this?

Gradle build failed to produce an .apk file. It's likely that this file was generated under C:\......\build, but the tool couldn't find it

I'm tring to build my flutter app on android in CMD and got message (in the subject) but app works properly.
The build proccess was OK and the problem started afer I changed one of the dependencies.
I have 2 flavors.
The android studio build create app without errors.
Any idea?
It's possible that the command is unable to find the build path to generate the APK. You can run these commands in the Terminal built into Android Studio.
For building APK for prod
flutter build apk --flavor prod -t lib/main_prod.dart
For building APK for dev
flutter build apk --flavor dev -t lib/main_dev.dart

Can't install unsigned Cordova apk

I just built a basic Cordova image, but I can't install it on my Android phone.
It says the package is corrupted.
I have enabled "Trust unknown sources" and copied the file onto my Nexus 6P.
The build process doesn't throw any errors, it creates a android-release-unsigned.apk file as expected.
Had the same problem as you because I followed the guide I linked in the comments above; that guide is for building a release build, not a test build.
In order to build a test build, do:
cordova build android
Which should create a file called debug-build.apk
In addition, if you have an android device set up for development, you can run:
cordova run android --device

How to build, install and test a release build of Android app using ant

I can build, install and test my applications using the ant commands in the /test project as described in Android documentation here
http://developer.android.com/tools/building/building-cmdline.html
But I can't find a way to build and install my release build.
It either:
- can't be tested as the certificates don't match (I have configured my test project to have a release build pointing to the same keystore etc), or
- fails with the error:
"Cannot run two different modes at the same time. If you are running more than one debug/release/instrument type targets, call them from different Ant calls."
I have tried all combinations of build commants, but can't get an myapp/bin/myapp-release.apk AND test/bin/test-release.apk built and installed to then run tests with.

Categories

Resources