This commit is contained in:
Ram Mehta 2018-08-05 02:50:51 -04:00
parent 068bf9c42e
commit c997016d98

View file

@ -34,6 +34,7 @@ from shutil import copyfile
from glob import glob from glob import glob
from buildozer.libs.version import parse from buildozer.libs.version import parse
from distutils.version import LooseVersion
class TargetAndroid(Target): class TargetAndroid(Target):
@ -797,10 +798,13 @@ class TargetAndroid(Target):
# maybe the hook fail because the apk is not # maybe the hook fail because the apk is not
pass pass
# XXX found how the apk name is really built from the title build_tools_versions = os.listdir(join(self.android_sdk_dir, "build-tools"))
build_tools_versions = sorted(build_tools_versions, key=LooseVersion)
build_tools_version = build_tools_versions[-1]
gradle_files = ["build.gradle", "gradle", "gradlew"] gradle_files = ["build.gradle", "gradle", "gradlew"]
is_gradle_build = any(( is_gradle_build = build_tools_version >= "25.0" and any(
exists(join(dist_dir, x)) for x in gradle_files)) (exists(join(dist_dir, x)) for x in gradle_files))
if is_gradle_build: if is_gradle_build:
# on gradle build, the apk use the package name, and have no version # on gradle build, the apk use the package name, and have no version
packagename = config.get('app', 'package.name') packagename = config.get('app', 'package.name')