-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility of old plugins with non-Java source-file entries (individual files) #547
Comments
P.S. This may affect apache/cordova-docs#902: Document how to use Android NDK libraries in plugins |
Reproduction steps in https://github.com/brodybits/cordova-sqlite-test-app:
Then I get errors such as:
It worked when I did Note that newer versions of cordova-sqlite-storage do not show this issue. My solution was to use P.S. The following reproduction steps lead to the same result on the master branch of cordova-android (this project):
|
source-file entries
source-file entries
source-file entries
Seems to have a similar issue with plugin cordova-plugin-app-preferences Got the following error when I make a cordova prepare after adding plugin :
I've rollback to Android 6.4.0 and it works. |
This is due to their use of hook scripts and I just raised apla/me.apla.cordova.app-preferences#142. I would like to keep it outside the scope of this issue (please feel free to raise a new issue and link it to apla/me.apla.cordova.app-preferences#142). |
@j3k0 I was able to get |
Great! I'll prepare a new version of the plugin without the installation hook. BTW, you might have noticed that we install the <!-- In-app Billing Library -->
<source-file src="src/android/com/android/vending/billing/IInAppBillingService.aidl" target-dir="src/com/android/vending/billing" />
<source-file src="src/android/com/android/vending/billing/IInAppBillingService.aidl" target-dir="app/src/main/aidl/com/android/vending/billing" /> Is there any better way to do this? |
(source-file entries) including aidl, aar, jar, and so files
(source-file entries) including aidl, aar, jar, and so files
(source-file entries) including aidl, aar, jar, and so files
(source-file entries) including aidl, aar, jar, and so files
(source-file entries) including aidl, aar, jar, and so files
Fix for old plugins with non-Java sources (GH-547)
This comment has been minimized.
This comment has been minimized.
(source-file entries) including aar, jar, and so files NOTE: target-lib mapping for aidl is NOT included in 7.1.x in order to avoid an already "exists" installation error on https://github.com/j3k0/cordova-plugin-purchase#master (v7.2.4) in a patch release of cordova-android.
Payments plugin is not supported here. For payments problem please raise a new issue on the payments plugin and explain why it is not a duplicate. |
avoid breaking plugins such as cordova-plugin-purchase
apacheGH-547 update for aidl files was breaking installation of cordova-plugin-purchase@latest (7.2.4)
Updates as proposed in PR #550 are now on the master branch. But I discovered that if I try adding I had an interesting discussion with @j3k0, with some good ideas in j3k0/cordova-plugin-purchase#759, would rather discuss these ideas here or in another Cordova issue. |
apacheGH-547 update for aidl files was breaking installation of https://github.com/j3k0/cordova-plugin-purchase#master (v7.2.4)
From j3k0/cordova-plugin-purchase#759 (comment):
cordova-android@7 project structure seems to be based on Android Studio project structure now, don't see how this could make a difference. Any other input would be appreciated.
+1
Cordova seems to use more portable tags such as |
When I see this proposed patch: } else if (obj.src.endsWith('.java')) {
return path.join(APP_MAIN_PREFIX, 'java', obj.targetDir.substring(4), path.basename(obj.src));
} else if (obj.src.endsWith('.aidl')) {
return path.join(APP_MAIN_PREFIX, 'aidl', obj.targetDir.substring(4), path.basename(obj.src));
} else if (obj.targetDir.includes('libs')) {
if (obj.src.endsWith('.so')) {
return path.join(APP_MAIN_PREFIX, 'jniLibs', obj.targetDir.substring(5), path.basename(obj.src));
} else {
return path.join('app', obj.targetDir, path.basename(obj.src));
} I wonder if the "fileType" part of Example: <source-file src="path/libfoo.so" type="jniLibs" />
<source-file src="path/IFoo.aidl" type="aidl" target-dir="..." />
<source-file src="path/Foo.bar" type="barFiles" target-dir="..." /> |
I think a much better solution is that we move away from using |
apacheGH-547 update for aidl files was breaking installation of https://github.com/j3k0/cordova-plugin-purchase#master (v7.2.4)
The duplicate problem is not just for the .aidl, it will happen on any extension if the plugin maintainer added different source-file tags for the same file but different paths for different cordova-android versions. Other than that, all we can do is copy the file even if it exists instead of failing, but that could be even a bigger breaking change. |
Interesting. So some remapping was introduced in 7.0.0, and some modified remapping was introduced in master, as was merged from #550. We know that the changes to the project structure and file remapping from 7.0.0 could be considered breaking changes, which evidently broke some plugins. This is valid from according to semver rules, but I did not see much in the way of notifying the community that plugins would be broken, testing of workaround solutions, etc. From this discussion I have a major concern that the modified remapping as introduced in master may prove to be a breaking change, which should definitely not be part of a patch release and also should not be part of a minor release. I think the modified remapping in master could really benefit the user community. I am now starting to wonder if we should consider proposing a major release, with the modified remapping, in the near future? |
The problem is people is using source-file for everything, while they should be using resource-file and lib-file in most cases. source-file should only be used for .java files, so that was the only case taken into account but as the use of source-file for non source files seems to be massive we had to do this patches to handle other file types different from .java. So trying to fix this is definitely a patch, not a breaking change, the purpose of the fix is to make old non updated plugins compatible. If it will break plugins that got "fixed" with some workaround, they will have to fix it again. |
I've just submitted a fix to another plugin. This one is a bit different because this behaviour of vaenow/cordova-plugin-app-update#119 FYI: though not documented officially, it is a known behaviour: |
@jcesarmobile I see your point now. I will update PR #555 for the patch release.
@ippeiukai thanks for reporting, I just raised apache/cordova#47 with the information and would like to continue discussion there. |
(source-file entries) including aidl, aar, jar, and so files
(source-file entries) including aidl, aar, jar, and so files
(source-file entries) including aidl, aar, jar, and so files
Closing as this issue is resolved in both master and 7.1.x branches. 7.1.3 patch release with this issue resolved should be available this week. |
Now fixed in the latest patch release |
From #542 (comment) & #542 (comment):
Some old plugins with non-Java source-file entries still do not seem to work since version 7.0.0. Some examples, including examples from #542 (comment):
cordova-sqlite-storage@2.1.5
(not an issue sincecordova-sqlite-storage@2.2.0
)(old version will not be supported)https://github.com/j3k0/cordova-plugin-purchase#v7.1.0
(version without any of the adaptations made to work with cordova-android@7, was part of cordova-plugin-purchase plugin issues #546)https://github.com/adjust/cordova_sdk#master
(see ERR_INVALID_ARG_TYPE after android@7.1.2 update #554)Example file types to deal with here:
.jar
- generally has target-dir="lib" in old plugins.aar
- also generally has target-dir="lib" in old plugins.so
- generally has a "lib" subdirectory in old pluginsPurpose is that a massive number of plugins should be able to just work on both old and new Android project structure.
The text was updated successfully, but these errors were encountered: