cordova-android icon indicating copy to clipboard operation
cordova-android copied to clipboard

Cordova 10.0.0 / android 9.0.0 / build successful / no apk produced

Open infuzz opened this issue 4 years ago • 3 comments

Bug Report

Problem

I have an issue with a specific third party plugin : https://github.com/vidinoti/cordova-plugin-PixLive

With a fresh empty cordova create app, no other plugin except whitelist, the BUILD is SUCCESSFUL but, NO apk is produced (debug or release) without the plugin, BUILD is SUCCESSFUL also but it produces the expected apk

My request is not about the third party plugin, but it's about "Why there is NO ERROR and BUILD marked as Successful, but no apk produced "? What could be done to investigate, or find what is wrong.

What is expected to happen?

BUILD SUCCESSFUL in 3s 42 actionable tasks: 42 executed Built the following apk(s): /myApp/platforms/android/app/build/outputs/apk/debug/app-debug.apk

What does actually happen?

BUILD SUCCESSFUL in 3s 42 actionable tasks: 42 executed Built the following apk(s):

The build is successful, there is absolutely no errors reported, but it doesn't produce any apk ???

Information

We use a plugin "cordova-plugin-pixlive" https://github.com/vidinoti/cordova-plugin-PixLive

This plugin requires to copy two items "VDARSDK.framework" and "vdarsdk-release.aar" to ./PixLiveSDK These two can be downloaded here by create a free test account : https://www.vidinoti.com/v-sdk/

Command or Code

cordova create myApp org.apache.cordova.myApp myApp cordova plugin add cordova-plugin-pixlive --variable LICENSE_KEY=test --variable PIXLIVE_SDK_IOS_LOCATION="./PixLiveSDK/VDARSDK.framework" --variable PIXLIVE_SDK_ANDROID_LOCATION="./PixLiveSDK/vdarsdk-release.aar" cordova platform add android cordova build --debug

Environment, Platform, Device

Debian 10.5

Version information

Cordova: Cordova CLI : 10.0.0 Cordova Platforms : android 9.0.0 Cordova Plugins cordova-plugin-whitelist@^1.3.4 cordova-plugin-pixlive@^1.15.0

Other Frameworks: None

Operating System : Debian 10.5 Android Studio : Android-sdk 25.0.0 Xcode : 12.2

Checklist

  • [X] I searched for existing GitHub issues
  • [X] I updated all Cordova tooling to most recent version
  • [X] I included all the necessary information above

infuzz avatar Nov 13 '20 19:11 infuzz

I took the time to create an account to test this.

It appears that this plugin messes with the cordova build scripts in some way and enforces multi arch setup whereas cordova expects a single apk to be built. This breaks cordova apk listing, but the APKs are indeed built. They are just in subfolders for each architecture (arm64, armv7, etc...).

norman@norman-ThinkPad:~/pixlive/platforms/android/app/build/outputs/apk$ ls
arm64  armeabi  armv7  x86  x86_64

Each of these folders will have a debug and/or release folder with the respective APKs inside each. You'd need to upload each APK to the google play store. Google requires you to support 64bit architecture, so at minimum you'll need arm64 APK, but uploading the others will probably be desirable for max device support.

I'll leave this open as a bug... Cordova could be smarter and scan for both build artefact structures regardless of the multiarch* setting. But in no way this issue is an actual blocker. APKs are being built, they are just simply not being listed in the output.

  • Even with the multi arch flag (cdvBuildMultipleApks) enabled, I observed the empty apk built list

breautek avatar Nov 13 '20 19:11 breautek

@breautek thank you to had a look on this so quiclky. Thank you to have pointed me to all apks that are effectively builded ! I didn't catch them. I have opened an issue at pixlive to request they make also a change on there side.

infuzz avatar Nov 13 '20 22:11 infuzz

可以试试这个解决办法,找到 ProjectBuilder.js 这个文件,搜索关键字 function findOutputFiles ,将59行至62行代码修改为:

let files = glob.sync(`**/${buildType}/*.${bundleType}`, {
    absolute: true,
    cwd: this[`${bundleType}Dir`]
}).map(path.normalize);
截屏2024-01-03 18 23 35

Masterxiechengxun avatar Jan 03 '24 10:01 Masterxiechengxun