I want to make a Kotlin to Python call using Chaquopy in Android studio

214 Views Asked by At

I want to be able to incorporate .py file using Chaquopy in Android Studio. But Android studio is happening the error like bellow...

Error Message① ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
} ↑ unexpected tokens (use ';' to separate expressions on the same line)

Error Message② com.chaquo.python.android.PyApplication, was not found in the project or the libraries

Supplement(version) Android Studio Giraffe
 Chaquopy 14.0.2 Python 3.9.13

I have been following the Chaquopy's official cite and other literature and tried the hints in Android studio, but it doesn't work.

Please it would be greatly appliciated if you could explain the details.

1

There are 1 best solutions below

1
On BEST ANSWER

Support for KTS build.gradle files will be added in Chaquopy 15, which should be released within the next couple of weeks. Until then, you can use a pre-release build as shown here:

  • At the top level of your project, edit the settings.gradle or build.gradle file to add this line to the repositories block within pluginManagement or buildscript (NOT within allprojects or dependencyResolutionManagement):
maven { url = uri("https://chaquo.com/maven-test") }
  • Edit the build.gradle file to change the Chaquopy version to 15.0.0.

  • In KTS files, you'll need to configure Chaquopy using a top-level chaquopy block, rather than the python block within android. For details, see the Chaquopy 15 documentation.