Github actions not picking up changes to build files in non-master branches - android-ndk

When building my android project via a github action, it always fails when the server hosting the action updates it's NDK plugin versions. This requires me to update my versions as well. However, it never seems to be simple.
For example, in a recent update I just made I noticed the NDK version was behind the server. So I downloaded the new version it's using to my local machine and updated the build files (including the local NDK path). After ensuring it builds fine on my local machine, I push to my branch. However, the server still thinks it's trying to build on the old version and fails the build (even though I told the gradle script to use the new version.).
I can successfully make this update on master, is there some reason actions/checkout#v2 doesn't recognize build file updates to non-master branches?
Welcome to Gradle 6.1.1!
Here are the highlights of this release:
- Reusable dependency cache
- Configurable compilation order between Groovy/Kotlin/Java/Scala
- New sample projects in Gradle's documentation
For more details see https://docs.gradle.org/6.1.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :app
WARNING: Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> No version of NDK matched the requested version 21.3.6528147. Versions available locally: 21.4.7075529, 21.4.7075529, 21.4.7075529, 22.1.7171670
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 24s
Error: Process completed with exit code 1.

Related

Sync ends with BUILD SUCCESSFUL but Make Project FAILS

All SO post on this subject (except for an unanswered one) describe the exact opposite situation: Build successful but Sync fails.
My situation is that I installed Android Studio for the first time (2021.3.1.17) and successfully imported an old (but working) Eclipse/ADT project of mine: Sync completes successfully, albeit with several warnings:
> Task :prepareKotlinBuildScriptModel UP-TO-DATE
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1s
It also warns about the Java version:
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Your current JDK is located in C:\Program Files\Java\jdk1.8.0_341\jre
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
Gradle settings
But when I try to Build > Make Project, it surprisingly ends with an ERROR:
Build file 'C:\Users\WebViewer\StudioProjects\MyApp\billing\build.gradle' line: 1
A problem occurred evaluating project ':billing'.
> Failed to apply plugin 'com.android.internal.library'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Your current JDK is located in C:\Program Files\Java\jdk1.8.0_341\jre
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
I understand the warnings (definitely good ones, prompting to update to current versions, and I eliminated the Java version one via File > Settings > Build Tools > Gradle) but... if Sync ends successfully, why would Make Project fail completely?
As a newcomer to Android Studio (IntelliJ + Gradle), I am confused by this discrepancy. Could someone please shed light on the essential difference between Sync, Make Project and Rebuild Project?

Could not find com.android.tools.build:gradle:7.5.1

So I was building out a test APK in Android Studio tonight that had to be signed. It failed and said my Gradle was out of date. So I upgraded my gradle from 7.3.3 to the newest 7.5.1
I changed the wrapper setting to distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
and then I changed my build.gradle dependency to classpath 'com.android.tools.build:gradle:7.5.1'
Note that after doing the changes, and restarting Android Studio, it did upgrade the version in the app directory.
Here's the error getting thrown below:
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:7.5.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
Required by:
project :
Note that this was a project from a client, and I did not write this originally. These dependencies were in place, but fairly recent, and the app would build fine with it using 7.3.3. However it wouldn't let me sign my app.
I suppose I could use some wisdom on both of these issues. What I'm going to do is go back to version 7.3.3, build the signed APK again, and copy that exact error to report back here with. It was a gradle version error.
For any any Flutter noobs like myself passing through, this error occured because the Android Tools Plugin version DOES NOT match the Gradle Version:
https://developer.android.com/studio/releases/gradle-plugin#groovy
They match up just vaguely enough in number, that you would think that my line com.android.tools.build:gradle:7.5.1. uses gradle 7.5.1, but instead, Android Tools for Gradle is actually a separate entity, and at 7.3.3 as of typing this reply.
So you CAN set your Gradle to the newest version somewhere else in your project, but it has to match the compatible Android Tools version, which is set here. Its silly and confusing at first, and can easily trip up newcomers. Hopefully the versions diverge enough, or the code syntax changes for some better clarity, but as of now, this is it.

FAILURE: Build failed with an exception. creating node js apps

I'm using cordova to create apps and when I used the command
cordova build android I got this error through the CLI:
c:\Apps\projeto_1>cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\Max\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Program Files (x86)\Android\android-sdk
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Starting Daemon
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 7s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
Where:
Script 'C:\Apps\projeto_1\platforms\android\CordovaLib\cordova.gradle' line: 75
What went wrong:
A problem occurred evaluating script.
No usable Android build tools found. Highest 30.x installed version is 29.0.3; minimum version required is 30.0.3.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 3s
Command failed with exit code 1: c:\Apps\projeto_1\platforms\android\gradlew cdvBuildDebug -b c:\Apps\projeto_1\platforms\android\build.gradle
Example of build failure: Build failed with an exception.
Where:
Script 'C:\Apps\projeto_1\platforms\android\CordovaLib\cordova.gradle' line: 75
What went wrong:
A problem occurred evaluating script.
No usable Android build tools found. Highest 30.x installed version is 29.0.3; minimum version required is 30.0.3.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 3s
Command failed with exit code 1: c:\Apps\projeto_1\platforms\android\gradlew cdvBuildDebug -b c:\Apps\projeto_1\platforms\android\build.gradle

Can not create workspace for Liferay 7.2-rc2

I am trying to create a workspace for 7.2-rc2 but fail to do so.
I created a normal workspace for 7.1 in Liferay Developer Studio (version 3.5.0) since there is no support for 7.2 yet. To test if I can run code correctly I created a new mvc-portlet in Developer Studio.
I then set liferay.workspace.target.platform.version=7.2.0 in gradle.properties. Gradle is not able to build my module:
15:16:04: Executing task 'deploy'...
Task :wrapper
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':modules:test:buildCSS'.
Could not resolve all dependencies for configuration ':modules:test:detachedConfiguration1'.
Could not find com.liferay.portal:release.portal.bom:7.2.0.
Searched in the following locations:
https://repo.maven.apache.org/maven2/com/liferay/portal/release.portal.bom/7.2.0/release.portal.bom-7.2.0.pom
https://repo.maven.apache.org/maven2/com/liferay/portal/release.portal.bom/7.2.0/release.portal.bom-7.2.0.pom
https://repository-cdn.liferay.com/nexus/content/groups/public/com/liferay/portal/release.portal.bom/7.2.0/release.portal.bom-7.2.0.pom
https://repository-cdn.liferay.com/nexus/content/groups/public/com/liferay/portal/release.portal.bom/7.2.0/release.portal.bom-7.2.0.pom
Required by:
project :modules:test
Could not find com.liferay.portal:release.portal.bom.compile.only:7.2.0.
Searched in the following locations:
https://repo.maven.apache.org/maven2/com/liferay/portal/release.portal.bom.compile.only/7.2.0/release.portal.bom.compile.only-7.2.0.pom
https://repo.maven.apache.org/maven2/com/liferay/portal/release.portal.bom.compile.only/7.2.0/release.portal.bom.compile.only-7.2.0.pom
https://repository-cdn.liferay.com/nexus/content/groups/public/com/liferay/portal/release.portal.bom.compile.only/7.2.0/release.portal.bom.compile.only-7.2.0.pom
https://repository-cdn.liferay.com/nexus/content/groups/public/com/liferay/portal/release.portal.bom.compile.only/7.2.0/release.portal.bom.compile.only-7.2.0.pom
Required by:
project :modules:test
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s
Could not find com.liferay.portal:release.portal.bom:7.2.0.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/liferay/portal/release.portal.bom/7.2.0/release.portal.bom-7.2.0.pom
- https://repo.maven.apache.org/maven2/com/liferay/portal/release.portal.bom/7.2.0/release.portal.bom-7.2.0.pom
- https://repository-cdn.liferay.com/nexus/content/groups/public/com/liferay/portal/release.portal.bom/7.2.0/release.portal.bom-7.2.0.pom
- https://repository-cdn.liferay.com/nexus/content/groups/public/com/liferay/portal/release.portal.bom/7.2.0/release.portal.bom-7.2.0.pom
Required by:
project :modules:test
15:16:07: Task execution finished 'deploy'.
I do not think the deprecation warning is at fault.
Which settings do I actually have to set to get all the necessary dependencies for 7.2?
It seems that 7.2.0-rc2 or rc3 have not been uploaded into the apache maven central repository yet. I'm also looking for a maven repository that has these artifacts.
By updating existing eclipse, you can build 7.2 plugin. Use below URL from liferay to update eclipse.
Install Liferay IDE

A problem occurred configuring project ':CordovaLib

When I try to compile using
ionic cordova build --release android
I get the following error message...What might be the reason..
BUILD FAILED in 0s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
[ERROR] An error occurred while running subprocess cordova.
cordova build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
It depends on what version of the Android NDK you are using. The suppport for MIPS and MIPS64 abis was stopped in NDK r17 (see Android NDK official documentation). This is because MIPS-based Android devices are completely obsolete. You need to use NDK r16 or older for it to work. You can download older NDK releases here. Alternativeley, as suggested here, you can just copy the corresponding directories from the NDK r17 (or older) in the r18 ndk-bundle/toolchains. The ones in the r17 are actually empty with a little notice that says that the directories were left there for compatibility. This last option is what I have done and it worked for me.
Its the problem with NDK tool chains file missing in NDK bundle, to resolve this issue make sure you properly install the NDK bundle, still if you cant fine try to download externally and place in the right path.
If your not using NDK tools for your app you can remove the entire folder of NDk and it will work fine with a warning message that NDK tools files missed

Resources