Closed licaon-kter closed 2 years ago
Previously the aTalk build.gradle, the ndk-tool path is specified in local.properties file i.e. ndk.dir=/opt/android/android-sdk/ndk/20.0.5594570; then this is referred to by using def ndkDir = android.ndkDirectory
However in the latest android studio, it gives the following warning when it was specified in local.properties. Android recommended method requires the use of "externalNativeBuild{}", but it is having problem as reported in: [163379002 Gradle externalNativeBuild script has problem in recognizing last include statement in Android.mk file] (https://issuetracker.google.com/issues/163379002). So the only option aTalk has right now is to specify and hard coded the ndkDir in the build.gradle. Not sure if anybody can provide an alternate solution without hard coded the path in build.gradle.
externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
}
}
Warning from android studio build process:
NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [20.0.5594570] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir
Please use v2.4.5 for Fdroid build. I have removed the hard coded path in the build.gradle.
Prior to aTalk v2.4.4 build, aTalk build.gradle uses the ndk.dir specified in the local properties; i.e. ndk.dir=/opt/android/android-sdk/ndk-bundle
==== local.properties =====
ndk.dir=/opt/android/android-sdk/ndk-bundle
sdk.dir=/opt/android/android-sdk
Actually the ndk-bundle directory always contains the android latest ndk released version as android studio is being upgraded. Recently AS has deprecated the support for ndk.dir; it now requires the ndk version to be specified in aTalk build.gradle and use the externalNativeBuild method instead as shown below:
// aTalk is only compatible to ndkVersion '20.0.5594570' max version
ndkVersion '20.0.5594570'
externalNativeBuild {
ndkBuild {
path file("jni/Android.mk")
}
}
All the android ndk release versions are saved in the respective directories, relative to sdk.dir=/opt/android/android-sdk as shown below. Fdroid build scripts need to be modified i.e. remove the ndk.dir in the local.properties to use the new aTalk build.gradle.
I see that fdroid build continues to use the local.properties method. If fdroid build process allowed and not in conflict with aTalk build.gradle, then you must download the correct ndk version and update the ndk.dir to: i.e. ndk.dir=/opt/android/android-sdk/ndk/20.0.5594570 so the version is the same as the one specified in the aTalk build.gradle.
2020-12-23 07:30:49,128 INFO: Updating local.properties file at build/org.atalk.android/local.properties 2020-12-23 07:30:49,128 INFO: Creating local.properties file at build/org.atalk.android/aTalk/local.properties 2020-12-23 07:30:49,128 INFO: Updating local.properties file at build/org.atalk.android/aTalk/local.properties
NDK from ndk.dir at /home/vagrant/android-ndk/r15c had version [15.2.4203891] which disagrees with android.ndkVersion [20.0.5594570]
Note: you cannot use this ndk version specified in build.gradle to build all the other native .so libraries used in aTalk, it is not compatible with the respective native library source.
Sorry, is Fdroid team still having problem with aTalk 2.4.5 build, even with the hard-coded path removed. Kindly revert to me if you need further assistance.
As the recipe changes show it needs more modifications, and I didn't get around to test them.
Please let me known me if the team still needs help.
I think the solution may just be copying all the files in android ndk directory for version 20.0.5594570, to the directory of the ndk.dir specified in the local.properties file. So the ndk version matches build.gradle version specified when gradle build the apk.
Please advice if Fdroid team still facing problem with the aTalk build. The latest aTalk release is v2.6.1.
I tried to build 2.6.1 but failed. See https://gitlab.com/linsui/fdroiddata/-/jobs/1351970271. x264 armv7 is built but armv8 failed. Could you please take a look? Thanks!
The 4 jni libraries i.e. ffmpeg, x264, openssl, and libvpx, use in aTalk actually need to undergo 2 build processes. a. Building the respective module static libraries i.e. .a using external scripts and configure file b. During Android Studio apk build, all the pre-built (a) static libraries are then built into shared libraries i.e. .so for use in aTalk.
Except for openssl, all the other 3 static libraries configure scripts support build via standalone ndk only; So far ANDROID_NDK=/opt/android/android-ndk-r18b has been verified working for all the 3 *.a static libraries built.
For the error log, found that fdroid is trying to use android pre-built ndk, i.e. /opt/android-sdk/ndk/20.0.5594570 for x264. This seems to be cause of the problem. You may refer to aTalk shell scripts for the building of ffmpeg-x264 static libraries.
You've hard coded the build tools paths :(
https://f-droid.org/wiki/index.php?title=org.atalk.android/lastbuild_1144&oldid=283988
I've tried to fix the recipe, but it's not done yet
build.patch