ncdcdev / cordova-plugin-blackboard-camera

0 stars 0 forks source link

[FEATURE] cordova9.0以降対応 #27

Open karuru6225 opened 1 year ago

karuru6225 commented 1 year ago

機能の説明

cordova9.0以降で、プラグインのビルドに関する仕様変更が行われているため、その変更への対応

Slackメモ

AndroidStudio環境設定

AGPとGradleのバージョンはデフォルトのままなのですが、 スクリーンショットのようになっています。
またJavaは11で、Project StructureのModulesの中にあるSource CompatibilityとTarget CompatibilityをJava11に選択しているのと、PreferenceのBuild, Execution, Deployment以下にあるBuild ToolsのGradle JDKも11にしてあります。
karuru6225 commented 1 year ago

参考になりそう https://qiita.com/kishisuke/items/de7cc491803b2791b829

karuru6225 commented 1 year ago

ビルドに使っているAndroid Studioのバージョン Android Studio Electric Eel | 2022.1.1 Patch 1

karuru6225 commented 1 year ago

npm install 'https://github.com/ncdcdev/cordova-plugin-blackboard-camera.git' を実行 config.xml に <plugin name="cordova-plugin-blackboard-camera" /> を追記 npx cordova prepare android を実行 Android Stuidoでビルド

で以下のエラー

> Task :app:compileDebugKotlin FAILED
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    /Users/kano/.gradle/caches/transforms-3/5eb3a4511c47ee9af726d8ba227f3212/transformed/jetified-kotlin-stdlib-jdk8-1.2.31.jar (version 1.2)
    /Users/kano/.gradle/caches/transforms-3/06a9610ed713bf2fc0afbba8d61a3727/transformed/jetified-kotlin-stdlib-jdk7-1.5.20.jar (version 1.5)
    /Users/kano/.gradle/caches/transforms-3/feaa07d1e1d0de2fab87e94f6f4d16a0/transformed/jetified-kotlin-stdlib-1.6.21.jar (version 1.6)
    /Users/kano/.gradle/caches/transforms-3/b35c7d613f7c50713cd058f5f26550a1/transformed/jetified-kotlin-stdlib-common-1.6.21.jar (version 1.6)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/Camera2Fragment.kt: (20, 24): Unresolved reference: media
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/Camera2Fragment.kt: (829, 70): Type mismatch: inferred type is String? but String was expected
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/Camera2Fragment.kt: (835, 35): Operator call corresponds to a dot-qualified call 'sensorOrientation.plus(newDeviceOrientation)' which is not allowed on a nullable receiver 'sensorOrientation'.
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/Camera2Fragment.kt: (1192, 32): Unresolved reference: ExifInterface
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/Camera2Fragment.kt: (1193, 64): Unresolved reference: ExifInterface
Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    /Users/kano/.gradle/caches/transforms-3/5eb3a4511c47ee9af726d8ba227f3212/transformed/jetified-kotlin-stdlib-jdk8-1.2.31.jar (version 1.2)
    /Users/kano/.gradle/caches/transforms-3/06a9610ed713bf2fc0afbba8d61a3727/transformed/jetified-kotlin-stdlib-jdk7-1.5.20.jar (version 1.5)
    /Users/kano/.gradle/caches/transforms-3/feaa07d1e1d0de2fab87e94f6f4d16a0/transformed/jetified-kotlin-stdlib-1.6.21.jar (version 1.6)
    /Users/kano/.gradle/caches/transforms-3/b35c7d613f7c50713cd058f5f26550a1/transformed/jetified-kotlin-stdlib-common-1.6.21.jar (version 1.6)

e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/Camera2Fragment.kt: (1193, 95): Unresolved reference: ExifInterface
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/Camera2Fragment.kt: (1201, 44): Unresolved reference: ExifInterface
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/Camera2Fragment.kt: (1205, 29): Unresolved reference: ExifInterface
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/Camera2Fragment.kt: (1208, 29): Unresolved reference: ExifInterface
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/CameraActivity.kt: (14, 31): Unresolved reference: ActivityCompat
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/CameraActivity.kt: (15, 27): Unresolved reference: content
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/CameraActivity.kt: (23, 64): Unresolved reference: ActivityCompat
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/CameraActivity.kt: (65, 26): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Bundle?
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/CameraActivity.kt: (66, 33): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Bundle?
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/CameraActivity.kt: (67, 39): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Bundle?
e: /Users/kano/git_repositories/ncdc/tpr2-android/app/platforms/android/app/src/main/java/jp/co/taisei/construction/fieldmanagement/plugin/CameraActivity.kt: (81, 17): Unresolved reference: ContextCompat
JangSungChul commented 1 year ago

Cordovaバージョン

❯ cordova -v
11.1.0
cordova-android@^10.1.1
cordova-ios@^6.2.0
cordova-android@^11.0.0
cordova-ios@^6.2.0
JangSungChul commented 1 year ago

KuiManagementSystemでの動作確認

npm i
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated stringify-package@1.0.1: This module is not used anymore, and has been replaced by @npmcli/package-json
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated date-format@3.0.0: 3.x is no longer supported. Please upgrade to 4.x or higher.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated intl-locales-supported@1.8.12: bad publish
npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated gulp-util@3.0.7: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @babel/polyfill@7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated superagent@3.8.3: Please upgrade to v7.0.2+ of superagent.  We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing.  See the releases tab for more information at .
npm WARN deprecated axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated core-js@1.2.7: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 1639 packages, and audited 1640 packages in 2m

91 packages are looking for funding
  run `npm fund` for details

53 vulnerabilities (16 moderate, 28 high, 9 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm run build-production2-compress
> app@1.0.0 build-production2-compress
> NODE_ENV=production2-compress npm run build

> app@1.0.0 build
> gulp build

environment: production
[17:14:01] Using gulpfile ~/git/KuiManagementSystem/app/gulpfile.js
[17:14:01] Starting 'build'...
[17:14:01] Starting 'config.xml'...
[17:14:01] Starting 'clean-xml'...
[17:14:01] Finished 'clean-xml' after 17 ms
[17:14:01] Starting ''...
[17:14:01] Finished '' after 43 ms
[17:14:01] Finished 'config.xml' after 62 ms
[17:14:01] Starting 'compile'...
[17:14:01] Starting 'copy-js'...
[17:14:01] Starting 'clean-js'...
[17:14:01] Finished 'clean-js' after 9.21 ms
[17:14:01] Starting ''...
[17:14:01] Finished '' after 7.85 ms
[17:14:01] Finished 'copy-js' after 20 ms
[17:14:01] Starting ''...
[17:15:01] asset bundle.js 13.1 MiB [emitted] [minimized] [big] (name: bundle) 1 related asset

WARNING in ./node_modules/material-ui/CheckBox/Checkbox.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* /Users/jang/git/KuiManagementSystem/app/node_modules/material-ui/CheckBox/Checkbox.js
    Used by 1 module(s), i. e.
    /Users/jang/git/KuiManagementSystem/app/node_modules/material-ui/CheckBox/index.js
* /Users/jang/git/KuiManagementSystem/app/node_modules/material-ui/Checkbox/Checkbox.js
    Used by 1 module(s), i. e.
    /Users/jang/git/KuiManagementSystem/app/node_modules/material-ui/Checkbox/index.js
 @ ./node_modules/material-ui/CheckBox/index.js 8:16-37
 @ ./src/js/components/input-item/item.js 46:0-44 329:50-58
 @ ./src/js/components/input-item/index.js 35:0-26 763:48-52
 @ ./src/js/containers/input-item.js 8:0-50 166:72-81
 @ ./src/js/pages.js 26:0-52 130:42-55
 @ ./src/js/index.js 15:0-27 135:13-23 139:13-28 143:13-27 147:13-25 151:13-33 155:13-30 159:13-32 163:13-29 167:13-22 171:13-27 175:13-32 179:13-32 183:13-32 187:13-34 191:13-34 195:13-34 199:13-33 203:13-30 207:13-27 211:13-24 215:13-28 219:13-39 223:13-39 227:13-35 231:13-35 235:13-27 239:13-33 243:13-39 247:13-33 251:13-39

WARNING in ./node_modules/material-ui/CheckBox/index.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* /Users/jang/git/KuiManagementSystem/app/node_modules/material-ui/CheckBox/index.js
    Used by 2 module(s), i. e.
    /Users/jang/git/KuiManagementSystem/app/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use[0]!/Users/jang/git/KuiManagementSystem/app/src/js/components/input-item/item.js
* /Users/jang/git/KuiManagementSystem/app/node_modules/material-ui/Checkbox/index.js
    Used by 4 module(s), i. e.
    /Users/jang/git/KuiManagementSystem/app/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use[0]!/Users/jang/git/KuiManagementSystem/app/src/js/components/black-board-edit/index.js
 @ ./src/js/components/input-item/item.js 46:0-44 329:50-58
 @ ./src/js/components/input-item/index.js 35:0-26 763:48-52
 @ ./src/js/containers/input-item.js 8:0-50 166:72-81
 @ ./src/js/pages.js 26:0-52 130:42-55
 @ ./src/js/index.js 15:0-27 135:13-23 139:13-28 143:13-27 147:13-25 151:13-33 155:13-30 159:13-32 163:13-29 167:13-22 171:13-27 175:13-32 179:13-32 183:13-32 187:13-34 191:13-34 195:13-34 199:13-33 203:13-30 207:13-27 211:13-24 215:13-28 219:13-39 223:13-39 227:13-35 231:13-35 235:13-27 239:13-33 243:13-39 247:13-33 251:13-39

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
  bundle.js (13.1 MiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  bundle (13.1 MiB)
      bundle.js

WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/

webpack 5.77.0 compiled with 5 warnings
[17:15:01] Finished '' after 60 s
[17:15:01] Finished 'compile' after 60 s
[17:15:01] Starting 'scss-global'...
[17:15:01] Starting 'copy-css'...
[17:15:01] Starting 'clean-css'...
[17:15:01] Finished 'clean-css' after 16 ms
[17:15:01] Starting ''...
[17:15:01] Finished '' after 180 ms
[17:15:01] Finished 'copy-css' after 198 ms
[17:15:01] Starting ''...
[17:15:01] Finished '' after 54 ms
[17:15:01] Finished 'scss-global' after 253 ms
[17:15:01] Starting 'html'...
[17:15:01] Starting 'clean-html'...
[17:15:01] Finished 'clean-html' after 3.71 ms
[17:15:01] Starting ''...
[17:15:01] Finished '' after 15 ms
[17:15:01] Finished 'html' after 33 ms
[17:15:01] Starting 'copy-image'...
[17:15:01] Starting 'clean-image'...
[17:15:01] Finished 'clean-image' after 33 ms
[17:15:01] Starting ''...
[17:15:01] Finished '' after 268 ms
[17:15:01] Finished 'copy-image' after 302 ms
[17:15:01] Finished 'build' after 1 min

npx cordova platform rm android

npx cordova platform add android@11
❯ Using cordova-fetch for cordova-android@11 Adding android project... android-targetSdkVersion should be greater than or equal to 32. Creating Cordova project for the Android platform: Path: platforms/android Package: jp.co.taisei.construction.fieldmanagement.prod2 Name: TPR2 Activity: MainActivity Android Target SDK: android-32 Android Compile SDK: 31 Subproject Path: CordovaLib Subproject Path: app Android project created with cordova-android@11.0.0 Discovered plugin "cordova-plugin-device". Adding it to the project Installing "cordova-plugin-device" for android Adding cordova-plugin-device to package.json Discovered plugin "cordova-plugin-statusbar". Adding it to the project Installing "cordova-plugin-statusbar" for android Adding cordova-plugin-statusbar to package.json Discovered plugin "cordova-plugin-android-permissions". Adding it to the project Installing "cordova-plugin-android-permissions" for android Adding cordova-plugin-android-permissions to package.json Discovered plugin "cordova-plugin-ios-camera-permissions". Adding it to the project Installing "cordova-plugin-ios-camera-permissions" for android Adding cordova-plugin-ios-camera-permissions to package.json Discovered plugin "cordova-plugin-file". Adding it to the project Installing "cordova-plugin-file" for android The Android Persistent storage location now defaults to "Internal". Please check this plugin's README to see if your application needs any changes in its config.xml. If this is a new application no changes are required. If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add: "" to config.xml in order for the application to find previously stored files. Adding cordova-plugin-file to package.json Discovered plugin "cordova-plugin-inappbrowser". Adding it to the project Installing "cordova-plugin-inappbrowser" for android Adding cordova-plugin-inappbrowser to package.json Discovered plugin "cordova-plugin-camera". Adding it to the project Installing "cordova-plugin-camera" for android Subproject Path: CordovaLib Subproject Path: app Adding cordova-plugin-camera to package.json Discovered plugin "cordova-plugin-base64-joewsh". Adding it to the project Installing "cordova-plugin-base64-joewsh" for android Adding cordova-plugin-base64-joewsh to package.json Discovered plugin "cordova-plugin-dialogs". Adding it to the project Installing "cordova-plugin-dialogs" for android Adding cordova-plugin-dialogs to package.json Discovered plugin "@havesource/cordova-plugin-push". Adding it to the project Installing "@havesource/cordova-plugin-push" for android Subproject Path: CordovaLib Subproject Path: app Adding @havesource/cordova-plugin-push to package.json Discovered plugin "cordova-plugin-androidx-adapter". Adding it to the project Installing "cordova-plugin-androidx-adapter" for android Adding cordova-plugin-androidx-adapter to package.json Discovered plugin "cordova-plugin-photo-library-sism". Adding it to the project Installing "cordova-plugin-photo-library-sism" for android Plugin dependency "cordova-plugin-file@6.0.2" already fetched, using that version. Dependent plugin "cordova-plugin-file" already installed on android. Adding cordova-plugin-photo-library-sism to package.json cordova-plugin-androidx-adapter: Processed 37 source files in 2227ms