Status Update
Comments
vi...@google.com <vi...@google.com>
ar...@google.com <ar...@google.com> #2
Hi, was this a regression after you upgrade your NDK or upgrade your Android Studio?
cm...@gmail.com <cm...@gmail.com> #3
Neither of them. There were no change to AS (4.1-RC1) nor NDK versions.
I just changed my old scripts in build.gradle to the android recommended method i.e.
externalNativeBuild { ndkBuild { path file('jni/Android.mk') } }
If I reverted the change to my old script, everything is working again. The old scripts uses
ndk.dir=/opt/android/android-sdk/ndk-bundle
as defined in local.properties file
The source.properties files indicate the version as:
Pkg.Desc = Android NDK Pkg.Revision = 21.3.6528147
tg...@google.com <tg...@google.com> #4
Hi, the problem is that when Android Gradle Plugin executes ndk-build, it is missing the '-C' + projectDir + '/jni'
part in your custom task. Therefore, the current working directory is the module root (parent of the jni
directory). Hence the error.
The fix is to add the following to your build.gradle
android {
...
defaultConfig {
...
externalNativeBuild {
ndkBuild {
arguments "-Cjni"
}
}
}
}
Please reopen the bug if you have further issues. Thanks!
cm...@gmail.com <cm...@gmail.com> #5
Please provide the full syntax for the externalNativeBuild scripts. gradle sync throws the following error message when I added the recommended argument statement to the script (or change to arguments('-Cjni'))
A problem occurred evaluating project ':aTalk'.
No signature of method: build_6xrerbyg3j4aatiomvrbavr6i.android() is applicable for argument types: (build_6xrerbyg3j4aatiomvrbavr6i$_run_closure4) values: [build_6xrerbyg3j4aatiomvrbavr6i$_run_closure4@497bb461]
externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
arguments "-Cjni"
}
}
tg...@google.com <tg...@google.com> #6
There are actually two different types of exteranlNativeBuild
blocks. The block in #4 needs to be put inside defaultConfig
android {
...
defaultConfig {
...
externalNativeBuild {
ndkBuild {
arguments "-Cjni"
}
}
}
...
externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
}
}
}
cm...@gmail.com <cm...@gmail.com> #7
But seeing the following errors not found in old method.
a. user now has to define what ABI to build for the adb debug; previously no such option and it is auto selected.
b. During run, it opens up a file (org_atalk_impl_neomedia_device_OpenSLESSystem.c) and indicates:
This file is not part of the project. Please include it in the appropriate build file (build.gradle, CMakeLists.txt or Android.mk etc.) and sync the project.
and the whole debug aborted with signel= SIGABRT (signal SIGABRT). and Note10 went black.
but the file already specified in the included file jni/opensles/Android.mk
# ========== OpenSLES (jnopensles.so library) ==================
### OpenSLES shared library build
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -lOpenSLES -llog
LOCAL_MODULE := jnopensles
LOCAL_SRC_FILES := \
org_atalk_impl_neomedia_device_OpenSLESSystem.c \
org_atalk_impl_neomedia_jmfext_media_protocol_opensles_DataSource.c \
org_atalk_impl_neomedia_jmfext_media_renderer_audio_OpenSLESRenderer.c
include $(BUILD_SHARED_LIBRARY)
However I realized that the new method perform the ndkBuild for every aTalk build variant (x4).
How do I make ndkBuild build only once for all the variants?
Moving the jni subDirectory into the ./src/main/jni does not seem to resolve the 4x build problem; but created other problems e.g.
a. Still proceed to build 4 times for the aTalk Build Variants.
b. Fail to perform adb install with the following error message (actual apk did contain the required ABI lib):
08/15 10:33:41: Launching 'aTalk' on samsung SM-N975F.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_NO_MATCHING_ABIS
List of apks:
[0] '/home/cmeng/workspace/android/atalk-android/aTalk/build/outputs/apk/playstore/debug/aTalk-playstore-debug.apk'
Installation failed due to: 'null'
Retry
tg...@google.com <tg...@google.com> #8
Hi, you can filter ABIs with
Can you share the project with your changes on build.gradle?
cm...@gmail.com <cm...@gmail.com> #9
You can download aTalk project sources from
ABIs with abiFilters is only for ABI variants; aTalk has already specified this in jni/Application.mk.
The shortfall in my earlier comment is externalNativeBuild{} will proceed to build the filtered ABI's for every aTalk built variants e.g. fdroid.release, fdroid.debug, playstore.release, playstore.release; 4 times when aTalk perform aTalk | Tasks | build | build selected from the Gradle ToolBar
tg...@google.com <tg...@google.com> #10
It's a current limitation that native builds cannot be shared across different variants. We are aware of this and would like to improve the situation. For now you may be able to workaround the problem by moving the native code into a separate module with a single variant and make the main module depending on it.
Could you elaborate what you mean by "a. user now has to define what ABI to build for the adb debug; previously no such option and it is auto selected."? What was your workflow for debugging? After using externalNativeBuild
, how exactly do you define the ABI to build?
Regarding app crash after deployment, do you have the same problem with the Android emulator?
cm...@gmail.com <cm...@gmail.com> #11
In old jni method, the ABI selection is automatically defined by AS pending on targeted device for debug.
Does this mean, using the externalNativeBuild{} method. user now has to decide which ABI to use pending on targeted device for debug.
Is there a need for such option, as the release build will have to include all the ABI's native libraries?
tg...@google.com <tg...@google.com> #12
This option is for the code editor (for example ABI-specific macro expansion). It won't affect deployment. When you deploy to a device, the right ABI would be built regardless of what you select in the "Build Variant" window. Is this not the behavior you have seen?
cm...@gmail.com <cm...@gmail.com> #13
For my debug test, like all other build variant options, I always ensure that I selected the ABI for my targeted device.
I did not verify if the debug apk contains the correct ABI native library if I have selected other instead.
cm...@gmail.com <cm...@gmail.com> #14
see
This morning I tried again using android recommend method to build aTalk jni; and with the latest upgraded development environment i.e.:
============
Build: AI-201.8743.12.41.6953283, 202011050241,
AI-201.8743.12.41.6953283, JRE 1.8.0_242-release-1644-b3-6222593x64 JetBrains s.r.o, OS Linux(amd64) v5.4.0-54-generic, screens 3840x2160
AS: 4.1.1; Kotlin plugin: 1.4.21-release-Studio4.1-1; Android Gradle Plugin: 4.1.1; Gradle: 6.5; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: LLDB 3.1 (revision: 3.1.4508709); CMake: from local.properties: (not specified), latest from SDK: 3.10.2, from PATH: (not found)
============
But I am still facing the same problem as reported earlier i.e.
============
b. During adb install/run, it opens up a file (org_atalk_impl_neomedia_device_OpenSLESSystem.c) and indicates:
This file is not part of the project. Please include it in the appropriate build file (build.gradle, CMakeLists.txt or Android.mk etc.) and sync the project.
and the whole debug aborted with Note10 hangs in splash screen.
2020-12-15 09:11:39.668 16720-21903/
but the file already specified in the included file jni/opensles/Android.mk i.e.
# ========== OpenSLES (jnopensles.so library) ==================
### OpenSLES shared library build
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -lOpenSLES -llog
LOCAL_MODULE := jnopensles
LOCAL_SRC_FILES := \
org_atalk_impl_neomedia_device_OpenSLESSystem.c \
org_atalk_impl_neomedia_jmfext_media_protocol_opensles_DataSource.c \
org_atalk_impl_neomedia_jmfext_media_renderer_audio_OpenSLESRenderer.c
include $(BUILD_SHARED_LIBRARY)
===========
Please advice how can I resolve the above problem so aTalk can proceed to migrate to the latest AS recommended method for jni build.
I also tested with AVD PIXEL-2_API-28, it too is facing the exact same problem.
If you need to verify the problem, please download the source from aTalk github repository:
then replace the file atalk project build.gradle with the attached file below:
cm...@gmail.com <cm...@gmail.com> #15
The problem seems to come from the android studio when doing "debug build" or the debugger. If I just build and install a release version (without the debug info), then the apk works without the problem.
tg...@google.com <tg...@google.com> #16
Without some background and familiarity with this project, it's difficult for me to understand why the app crashes. From logcat, it appears the assertion at line 74 in <project>\aTalk\jni\opensles\org_atalk_impl_neomedia_device_OpenSLESSystem.c
failed (I appended && 1
, && 2
, && 3
, etc to each assertion expression and found this out). I have never used OpenSLES. Maybe it's better to ask on stackoverflow.
cm...@gmail.com <cm...@gmail.com> #17
1. The assertion exception as you have mentioned. What I see is that this only happens when the jni source is complied for DEBUG. When I run aTalk debug version as it, i.e. without the debugger attached; it throws the following exception as shown in the logcat. aTalk crashes on startup, and OS shows "aTalk keeps stopping" every time aTalk is launched.
Your team needs to understand why the assertion crashes the system when the jni source is compiled for debug, but not in release version.
However if I build aTalk release version, there is not such exception. Look like the exception is introduced by the debug version build process.
As a patch to the first problem, I comment out the assertion statement. this eliminate the assertion exception from occurring. aTalk can still work without this assertion statement, as shown in the logcat info.
I/OpenSLES: Create Audio Engine
I/OpenSLES: Realize Audio Engine; engineObject_: 0x723c799c00
W/libOpenSLES: Leaving Object::GetInterface (SL_RESULT_FEATURE_UNSUPPORTED)
E/OpenSLES: Failed: Query Audio Input Capabilities
2. "This file is not part of the project. Please include it in the appropriate build file (build.gradle, CMakeLists.txt or Android.mk etc.) and sync the project".
The above is thrown by the debugger when the assertion occur. Look like the debugger is unable to link the source to the project, even though it is defined in the Android.mk.
Any proposed solution to resolve this second problem?
========= Assertion exception =========
2020-12-16 08:04:59.191 12018-12899/
2020-12-16 08:04:59.246 12923-12923/? A/DEBUG: pid: 12018, tid: 12899, name: k.AsyncExecutor >>>
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #02 pc 0000000000001694 /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/lib/arm64/libjnopensles.so (Java_org_atalk_impl_neomedia_device_OpenSLESSystem_queryAudioInputCapabilities+456) (BuildId: 568eb5ff8fbe900b4e2eab8356b76a3b53fbd207)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #10 pc 0000000000292f14 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.OpenSLESSystem.doInitialize+32)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #13 pc 000000000028f514 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.initialize+8)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #16 pc 000000000028fa16 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.invokeDeviceSystemInitialize+14)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #19 pc 000000000028f9ee [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.invokeDeviceSystemInitialize+2)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #22 pc 000000000028f4d2 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.<init>+58)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #25 pc 000000000028d9b4 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.AudioSystem.<init>+4)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #28 pc 000000000028d996 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.AudioSystem.<init>+2)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #31 pc 0000000000292edc [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.OpenSLESSystem.<init>+4)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #45 pc 000000000028f6d2 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.initializeDeviceSystems+254)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #48 pc 000000000028f9c4 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.initializeDeviceSystems+392)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #51 pc 000000000028f594 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceSystem.initializeDeviceSystems+36)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #57 pc 000000000028e858 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.device.DeviceConfiguration.<init>+60)
2020-12-16 08:04:59.304 12923-12923/? A/DEBUG: #60 pc 000000000022df92 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.MediaServiceImpl.<init>+10)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #74 pc 000000000022b9be [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.libjitsi.LibJitsiImpl$ServiceLock.initializeService+114)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #77 pc 000000000022b906 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.libjitsi.LibJitsiImpl$ServiceLock.getService+38)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #80 pc 000000000022bb00 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.libjitsi.LibJitsiImpl.getService+60)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #83 pc 00000000002dca2c [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.service.libjitsi.LibJitsi.invokeGetServiceOnImpl+8)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #86 pc 00000000002dcb5c [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.service.libjitsi.LibJitsi.getMediaService+4)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #89 pc 0000000000234cd6 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.neomedia.NeomediaActivator.start+14)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #92 pc 00000000002d3308 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.BundleImpl.start+220)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #95 pc 00000000002d48f6 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.launch.FrameworkImpl.startLevelChanged+78)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #98 pc 00000000002d4ca2 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.startlevel.FrameworkStartLevelImpl$Command.run+90)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #101 pc 00000000002d280a [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.AsyncExecutor.runInThread+154)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #104 pc 00000000002d2728 [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.AsyncExecutor.access$000)
2020-12-16 08:04:59.305 12923-12923/? A/DEBUG: #107 pc 00000000002d21da [anon:dalvik-classes2.dex extracted in memory from /data/app/org.atalk.android-ceIazAbZs89ZVWEs54oQ7w==/base.apk!classes2.dex] (org.atalk.impl.osgi.framework.AsyncExecutor$1.run+6)
tg...@google.com <tg...@google.com> #18
Thanks! Problem #2 is a bug in AGP and we will fix it in future releases.
Description
Build: AI-201.8743.12.41.6719854, 202007291913,
AI-201.8743.12.41.6719854, JRE 1.8.0_242-release-1644-b3-6222593x64 JetBrains s.r.o, OS Linux(amd64) v4.15.0-72201912051620-generic, screens 3840x2160
AS: 4.1 RC 1; Kotlin plugin: 1.3.72-release-Studio4.1-5; Android Gradle Plugin: 4.1.0-rc01; Gradle: 6.5; NDK: from local.properties: 21.3.6528147, latest from SDK: 21.3.6528147; LLDB: LLDB 3.1 (revision: 3.1.4508709); CMake: from local.properties: (not specified), latest from SDK: 3.6.0-rc2, from PATH: (not found)
IMPORTANT: Please readhttps://developer.android.com/studio/report-bugs.html carefully and supply all required information.
For any other aTalk files reference, aTalk project sources can be download fromhttps://github.com/cmeng-git/atalk-android
aTalk implements native jni library for media processing support. As per the link recommendation. aTalk includes the jni build scripts in gradle.build file.
Link Gradle to your native libraryhttps://developer.android.com/studio/projects/gradle-external-native-builds
i.e.:
However AS throws the following error when doing a gradle sync; it seems that NDK cannot recognize the last include ./openssl/Android_a.mk in the Android.mk file.
Previously aTalk uses its own build scripts as shown below, there is no such problem. i.e.