Azure AppCenter: Android build succeeds but no APKs found - android

I've been setting up Azure App Center build pipelines and after some troubleshooting, I managed to make our debug build succeed. The issue is that, it seems to not be able to find any of the generated APKs in the expected directories. Any ideas on why that is?
Here's the specific part of the output log:
BUILD SUCCESSFUL in 4m 28s 130 actionable tasks: 124 executed, 6
up-to-date
##[section]Finishing: Gradle Task
##[section]Starting: Android Postprocess
============================================================================== Task : Shell script Description : Run a shell script using
Bash Version : 2.206.0 Author : Microsoft Corporation Help
:
https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/shell-script
============================================================================== [command]/bin/bash
/Users/runner/runners/2.206.1/scripts/android-postprocess.sh
/Users/runner/work/1/s/build/outputs/apk Removing all ABI or density
dependent APKs… find: /Users/runner/work/1/s/build/outputs/apk: No
such file or directory find: /Users/runner/work/1/s/build/outputs/apk:
No such file or directory find:
/Users/runner/work/1/s/build/outputs/apk: No such file or directory
Found 0 APK file(s) Found 0 unaligned APK file(s) find:
/Users/runner/work/1/s/build/outputs/apk: No such file or directory
/Users/runner/runners/2.206.1/scripts/android-postprocess.sh: line 36:
pushd: /Users/runner/work/1/s/build/outputs/apk/..: No such file or
directory
/Users/runner/runners/2.206.1/scripts/android-postprocess.sh: line 43:
popd: directory stack empty
##[error]The process '/bin/bash' failed with exit code 1
##[error]Bash failed with error: The process '/bin/bash' failed with exit code 1
##[section]Finishing: Android Postprocess
I also have a post-clone bash script for generating the local.properties file which contains some secrets, and it seems to work just fine since the build uses it and goes through with it.
Sadly, I can't infer much from the logs, I'm not a DevOps engineer and have practically 0 experience in this sector.

Related

unable to to run bazel build command

I m trying to execute handtracking android app using bazel and when I run the build command I get this error :
can you help me fix it please
ERROR: C:/users/admin/mediapipe_repo/mediapipe/mediapipe/framework/formats/BUILD:251:24: C++ compilation of rule '//mediapipe/framework/formats:landmark_cc_proto' failed (Exit 1): clang fai
led: error executing command external/androidndk/ndk/toolchains/llvm/prebuilt/windows-x86_64/bin/clang -gcc-toolchain external/androidndk/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/w
indows-x86_64 -target ... (remaining 57 argument(s) skipped)
clang: error: no such file or directory: '/w'
clang: error: no such file or directory: '/D_USE_MATH_DEFINES'
clang: error: no such file or directory: '/std:c++17'
Target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 151.344s, Critical Path: 132.86s
INFO: 160 processes: 128 internal, 31 local, 1 worker.
FAILED: Build did NOT complete successfully
There is a note in the Mediapipe documentation:
Note: building MediaPipe Android apps is still not possible on native Windows. Please do this in WSL instead and see the WSL setup instruction in the next section.
This implies that what you are trying to do is currently not possible, sorry. See also this issue for other people in your situation.

Android - Copy build output to another folder with Gradle

I am trying to build my React Native Android app on Visual Studio App Center and I get this error:
Task : Shell script
Description : Run a shell script using Bash
Version : 2.165.0
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/shell-script
==============================================================================
[command]/bin/bash /Users/runner/runners/2.165.2/scripts/android-postprocess.sh /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk
Removing all ABI or density dependent APKs…
find: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk: No such file or directory
find: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk: No such file or directory
find: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk: No such file or directory
Found 0 APK file(s)
Found 0 unaligned APK file(s)
find: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk: No such file or directory
/Users/runner/runners/2.165.2/scripts/android-postprocess.sh: line 36: pushd: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk/..: No such file or directory
/Users/runner/runners/2.165.2/scripts/android-postprocess.sh: line 43: popd: directory stack empty
##[error]The process '/bin/bash' failed with exit code 1
##[error]Bash failed with error: The process '/bin/bash' failed with exit code 1
##[section]Finishing: Android Postprocess
##[section]Starting: Post Build Script
It's incorrectly looking for my APK in the app/app/build/... instead of app/build/...So I want to copy the files to app/app/build/.. so it finds them there.
I can't copy the files with a post-build script because it runs after the script that throws the error.
Is it possible to somehow achieve copying with Gradle? Or maybe have multiple build paths? Or some other solution?
The problem was that I had gradlew, gradlew.bat and gradle folder in my appmodule folder. I must have mistakenly opened the app folder alone in Android Studio and synced the project.
I solved it by creating a fresh React Native project.

Cannot find apk architecture when run command "ionic cordova run android"

When I run command
ionic cordova run android
build is succeeded but app cannot be run on my android device.
The error log is as:
BUILD SUCCESSFUL in 4m 7s
47 actionable tasks: 45 executed, 2 up-to-date
Built the following apk(s):
ANDROID_HOME=C:\Users\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_121
No target specified, deploying to device 'UGM0217321003049'.
Skipping build...
Built the following apk(s):
Error: Could not find apk architecture: arm build-type: debug
[ERROR] An error occurred while running subprocess cordova.
cordova run android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Under the directory platforms/android/build/outputs/apk, there is only one folder called debug under which there are two file android-debug.apk and output.json.
apk
|---debug
|---android-debug.apk
|---output.json
I suspect there should be some arm architecture file in apk directory, but I don't know how to generate it.
Can you help me to solve this run android error?
To avoid extended discussions in comments, let me summarise the workaround as below:
Try to run below command to build the apk first.
cordova build android
or
ionic cordova build android
Look for the apk from platforms\android and manually install it.
How to automatically build the android-debug.apk in app folder?
the .json file is auto generated, usually you don't need to touch it.
By default, the apk path is under app/build/outputs/apk, you can copy it to a custom location wherever you prefer, for your case, maybe it is app/ root directory. You can do this with many means, e.g. bash scripts. Below gradle snippets is how I do this task, just copy below code to the end of your app/build.gradle:
def capitalizeFirstLetter(s) { s[0].toUpperCase() + s[1..-1] }
def publish = project.tasks.create("copyApks")
publish.description "Copies apks to custom directory"
android.applicationVariants.all { variant ->
def customPath
variant.outputs.all {
customPath = "$projectDir"
def capitalizedVariantName = capitalizeFirstLetter(variant.name)
def task = project.tasks.create("copy${capitalizedVariantName}Apk", Copy)
task.from(outputFile)
task.into(customPath)
task.dependsOn variant.assemble
publish.dependsOn task
}
}
From your command line, run ./gradlew copyApks or gradlew copyApks on macOS or Windows respectively.
Then you will find your apk is under app\ directory.

Android chromium full browser apk build issues

I trying to build chromium android apk with this instruction
But on GN configuration step I have following problem after arguments file editing and saving
ERROR at //build/config/android/internal_rules.gni:1966:13: Script returned non-zero exit code.
exec_script("//build/android/gyp/find.py",
^----------
Current dir: /home/artem/chromium/src/out/Default/
Command: python -- /home/artem/chromium/src/build/android/gyp/find.py ../../third_party/android_tools/sdk/extras/google/google_play_services/libproject/google-play-services_lib/res
Returned 1.
stderr:
../../third_party/android_tools/sdk/extras/google/google_play_services/libproject/google-play-services_lib/res does not exist
See //build/config/android/rules.gni:634:3: whence it was called.
process_resources(process_resources_target_name) {
^-------------------------------------------------
See //third_party/android_tools/BUILD.gn:120:1: whence it was called.
android_resources("google_play_services_default_resources") {
^------------------------------------------------------------
See //base/BUILD.gn:1074:7: which caused the file to be included.
"//third_party/android_tools:cpu_features",
^-----------------------------------------
Then I try manually download google play services with command from this issue thread:
sudo ./build/android/play_services/update.py download
And get this warning:
Your version of the Google Play services library is not up to date. You might run into issues building or running the app. Please run `./build/android/play_services/update.py download` to retry downloading it.
After that I try to build full browser apk
ninja -C out/Default chrome_public_apk
and get error:
ninja: Entering directory `out/Default'
ninja: fatal: chdir to 'out/Default' - No such file or directory
Is there the way to fix this issue and build working apk file?
This works for me:
Run this command at chromium folder:
git rebase-update
gclient sync
Download google play services:
sudo ./build/android/play_services/update.py download
Configure GN: gn args opt/Full
Add this line to file: target_os="android"
Build apk with command: ninja -C opt/Full chrome_public_apk

Cannot build cordova project successfully error while executing ant debug command

I was having an error that is Camera not successful invoked on first try (click) so I tried this solution on stackoverflow Phonegap(3.0.0) Camera not successful on first try.
I followed the steps as mentioned in the answer removed android by cordova platform remove android then I run the second command cordova platform add android ;
Now when I use netbeans to run the cordova application on cordova android decvice this error occurs:
exec: ant debug -f "/var/www/mobile/platforms/android/build.xml"
[ 'ant debug -f "/var/www/mobile/platforms/android/build.xml"',
{ [Error: Command failed:
BUILD FAILED
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 8 seconds
] killed: false, code: 1, signal: null },
'Buildfile: /var/www/mobile/platforms/android/build.xml\n\n-set-mode-check:\n\n-set-debug-files:\n\n-check-env:\n [checkenv] Android SDK Tools Revision 22.3.0\n [checkenv]
.
.
.**LONG TEXT which I removed from the post **
.
\nBUILD FAILED\n/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:720:
The following error occurred while executing this line:\n/var/www/adt-bundle-linux-x86_64- 20130917/sdk/tools/ant/build.xml:734:
Compile failed; see the compiler error output for details.\n\nTotal time: 8 seconds\n' ]
Error executing "ant debug -f "/var/www/mobile/platforms/android/build.xml"":
BUILD FAILED
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 8 seconds
child_process.spawn(/var/www/mobile/platforms/android/cordova/build,[]) = 2
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
Error: An error occurred while building the android project.Error executing "ant debug -f "/var/www/mobile/platforms/android/build.xml"":
BUILD FAILED
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 8 seconds
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cordova/src/compile.js:65:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
/var/www/mobile/nbproject/build.xml:256: exec returned: 8
BUILD FAILED (total time: 4 minutes 36 seconds)
any idea about this problem?
I was having a similar issue. I ran ant debug -f "/path/to/project/build.xml" from a separate terminal. It displayed a more specific description of the error (which for me wast that there was a space in the project name). This answer also notes:
config.xml can't have a widget id with number as a first character
after a dot. For example: com.42myapp.test or com.myapp.42test won't
work as well as 42com.myapp.test. It will trigger an error from the
compiler.
I was facing similar issues when i started using the CLI to build apps using cordova and started checking the internet for solutions. While i was at it, i discovered the following things that may help you or anyone else facing the same problem can take some hints from this:
These are some very basic checks that you need to take
1. make sure you have all the required sdk's in place (ANT, Java, Android) and is available when you use these commands on the terminal/command $ ant $ java $ adt. if any of these commands are not found, then you need to get it installed or get the class paths fixed.
make sure your project path does not have spaces. i.e. do not have spaces or special characters in directory names. this issue seems to have been fixed on latest versions of cordova and phonegap, but either cases it is a good practice to follow as ant and java paths could be dependent on the folder names you make.
use -d or -v to get extra debug information on the build process to know where and what is causing the issue. $ cordova build android -d or $ cordova build android -v
Make sure you dont use "#" as the link attribute of author tag in the cordova config.xml on the root of the project. This expects the compiler to interpret a hexadecimal color and fails the build. (this was my problem)
Hope this helps.
er... Happy debugging??
Make sure your Ant is 1.8.0 or later version. Cordova 3.3 demands that.
In the past several days, I found that the conflicting files from Dropbox had a very long name. After renaming it, everything worked.

Categories

Resources