facebook twitter hatena line email

「Cordova/helloworld」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(iphoneバージョンが対応してないエラー)
(iphoneバージョンが対応してないエラー)
行95: 行95:
 
  warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, but the range of supported deployment target versions is 8.0 to 13.1.99. (in target 'nanopb' from project 'Pods')
 
  warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, but the range of supported deployment target versions is 8.0 to 13.1.99. (in target 'nanopb' from project 'Pods')
 
  error: Signing for "HelloworldExample" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'HelloworldExample' from project 'HelloworldExample')
 
  error: Signing for "HelloworldExample" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'HelloworldExample' from project 'HelloworldExample')
作成されてるplatforms/ios/AdmobBasicExample.xcworkspaceをxcodeで開く
+
#作成されてるplatforms/ios/AdmobBasicExample.xcworkspaceをxcodeで開く
 +
#Signing & capabilitiesの TeamがNoneになっているので、追加する
  
 
==参考==
 
==参考==

2020年5月27日 (水) 20:08時点における版

プロジェクト作成

cordova create helloworld com.example.helloworld helloworld
cd helloworld

プラットフォーム追加

cordova platform add android
cordova platform add ios
cordova platform add browser

browerをビルドチェック&ビルド&実行

cordova requirements browser
cordova build browser
cordova run browser

アクセス ttp://localhost:8000/index.html

androidをビルドチェック&ビルド&実行

ビルドチェック

$ cordova requirements android
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-29,android-28,android-27,android-26,android-24
Gradle: installed /usr/local/Cellar/gradle/6.4.1/bin/gradle

ビルド

$ cordova build android

実行

$ cordova run android

実機がつながってれば、apache cordovaと画面が出た。

gradle pathエラーが出たとき

Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
Some of requirements check failed

macであれば・・・

$ brew install gradle
$ gradle -v
$ Gradle 6.4.1

以下のようなjavaエラーが起こったら

avdmanager: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

1.8かどうか確認する javaが11とかなら1.8に変更する

$ vi ~/.bash_profile

#export JAVA_HOME=`/usr/libexec/java_home -v 11`
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

cordovaプロジェクトでないエラー

以下エラーが出るときは、wwwやconfig.xmlがあるプロジェクトで実行してるか確認。

Current working directory is not a Cordova-based project.

cordova platform addエラーが出る

プラットフォームが追加されてないと出る場合

No platforms added to this project. Please use `cordova platform add <platform>`

androidであれば、以下のようにプラットフォームを追加する

$ cordova platform add android

iosをビルドチェック&ビルド&実行

ビルドチェック

$ cordova requirements ios
Requirements check results for ios:
Apple macOS: installed darwin
Xcode: installed 11.1
ios-deploy: installed 1.10.0
CocoaPods: installed 1.9.2

ビルド

$ cordova build ios
** BUILD SUCCEEDED **

実行

$ cordova run ios
Simulator successfully started via `ios-sim`.

ビルドチェックでpodが無いエラーが出るとき

CocoaPods: not installed
/bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory

以下を実行

sudo gem install -n /usr/local/bin cocoapods

それでもだめなら、以下も実行してみる

sudo gem update --system
sudo gem uninstall cocoapods

プラットフォームが追加されてないエラー

以下エラーが出たときは

The platform "ios" does not appear to have been added to this project.

iosプラットフォームを追加する

cordova platform add ios

iphoneバージョンが対応してないエラー

warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, but the range of supported deployment target versions is 8.0 to 13.1.99. (in target 'nanopb' from project 'Pods')
error: Signing for "HelloworldExample" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'HelloworldExample' from project 'HelloworldExample')
  1. 作成されてるplatforms/ios/AdmobBasicExample.xcworkspaceをxcodeで開く
  2. Signing & capabilitiesの TeamがNoneになっているので、追加する

参考

https://qiita.com/AyumuSuzuki/items/17945ea1cfff1418e364

https://qiita.com/cognitom/items/3b30284e8d01eaf122b7