Ad
1: 2019-05-21 (火) 22:10:58 njf ソース バックアップ No.1 を復元して編集 現: 2021-06-13 (日) 03:05:01 ゲスト[S1oSntjXCEs] ソース 編集
Attached file: file_105.txt, Attached file: file_106.txt, Attached file: file_107.txt, Attached file: file_108.txt, Attached file: file_109.txt, Attached file: passwd%00_5.jpg, Attached file: ..%2F..%2F..%2F..%2F._2.%, Attached file: passwd%00_6.jpg, Attached file: file_110.txt, Attached file: file_111.txt, Attached file: win.ini%00_2.jpg, Attached file: file_112.txt, Attached file: file_113.txt, Attached file: file_114.txt, Attached file: file_115.txt, Attached file: file_116.txt, Attached file: file_117.txt, Attached file: file_118.txt, Attached file: file_119.txt, Attached file: file_120.txt, Attached file: file_121.txt, Attached file: file_122.txt, Attached file: file_123.txt, Attached file: file_124.txt, Attached file: file_125.txt, Attached file: file_126.txt, Attached file: file_127.txt, Attached file: file_128.txt, Attached file: file_129.txt, Attached file: file_130.txt, Attached file: some_inexistent_file_wi_2, Attached file: 1some_inexistent_file_w_2, Attached file: fit_2.txt, Attached file: file_131.txt, Attached file: AcuTestEXIF4028.jpg, Attached file: fit.txt%3F_2.jpg, Attached file: file_132.txt, Attached file: file_133.txt, Attached file: file_134.txt, Attached file: file_135.txt, Attached file: file_136.txt, Attached file: file_137.txt, Attached file: file_138.txt, Attached file: file_139.txt, Attached file: file_140.txt, Deleted an attach file: file_106.txt at 2021-06-12 (土) 23:39:02 at 2021-06-12 (土) 23:39:03 at 2021-06-12 (土) 23:39:11 at 2021-06-12 (土) 23:39:18 at 2021-06-12 (土) 23:39:19 at 2021-06-12 (土) 23:39:19 at 2021-06-12 (土) 23:39:21 at 2021-06-12 (土) 23:39:22 at 2021-06-12 (土) 23:39:27 at 2021-06-12 (土) 23:39:28 at 2021-06-12 (土) 23:39:29 at 2021-06-12 (土) 23:39:30 at 2021-06-12 (土) 23:39:34 at 2021-06-12 (土) 23:39:35 at 2021-06-12 (土) 23:39:39 at 2021-06-12 (土) 23:39:40 at 2021-06-12 (土) 23:39:40 at 2021-06-12 (土) 23:39:41 at 2021-06-12 (土) 23:39:41 at 2021-06-12 (土) 23:39:42 at 2021-06-12 (土) 23:39:49 at 2021-06-12 (土) 23:39:50 at 2021-06-12 (土) 23:39:51 at 2021-06-12 (土) 23:39:51 at 2021-06-12 (土) 23:39:52 at 2021-06-12 (土) 23:39:59 at 2021-06-12 (土) 23:40:00, Deleted an attach file: fit.txt at 2021-06-12 (土) 23:40:05 at 2021-06-12 (土) 23:40:06 at 2021-06-12 (土) 23:40:07 at 2021-06-12 (土) 23:40:13 at 2021-06-12 (土) 23:40:14 at 2021-06-12 (土) 23:40:15 at 2021-06-12 (土) 23:40:15 at 2021-06-12 (土) 23:40:18 at 2021-06-12 (土) 23:40:19 at 2021-06-12 (土) 23:40:20 at 2021-06-12 (土) 23:40:20 at 2021-06-12 (土) 23:40:21 at 2021-06-12 (土) 23:40:22 at 2021-06-12 (土) 23:40:23 at 2021-06-12 (土) 23:40:23 at 2021-06-12 (土) 23:40:25 at 2021-06-12 (土) 23:40:25 at 2021-06-12 (土) 23:40:25 at 2021-06-12 (土) 23:40:26 at 2021-06-12 (土) 23:40:27 at 2021-06-12 (土) 23:40:32 at 2021-06-12 (土) 23:40:33 at 2021-06-12 (土) 23:40:34 at 2021-06-12 (土) 23:40:35 at 2021-06-12 (土) 23:40:35 at 2021-06-12 (土) 23:40:38 at 2021-06-12 (土) 23:40:39 at 2021-06-12 (土) 23:40:40 at 2021-06-12 (土) 23:40:40 at 2021-06-12 (土) 23:40:40 at 2021-06-12 (土) 23:40:40 at 2021-06-12 (土) 23:40:41 at 2021-06-12 (土) 23:40:42 at 2021-06-12 (土) 23:44:24 at 2021-06-12 (土) 23:44:49 at 2021-06-12 (土) 23:51:37 at 2021-06-12 (土) 23:52:05 at 2021-06-12 (土) 23:58:11 at 2021-06-12 (土) 23:58:43 at 2021-06-13 (日) 00:03:58 at 2021-06-13 (日) 00:04:25 at 2021-06-13 (日) 00:04:53 at 2021-06-13 (日) 00:04:54 at 2021-06-13 (日) 00:04:54 at 2021-06-13 (日) 00:04:55 at 2021-06-13 (日) 00:04:56 at 2021-06-13 (日) 00:04:57 at 2021-06-13 (日) 00:05:30 at 2021-06-13 (日, Attached file: file_105_85.txt, Attached file: file_105_86.txt, Attached file: file_105_87.txt, Deleted an attach file: file_104.txt at 2021-06-13 (日) 02:29:36, Deleted an attach file: file_103.txt at 2021-06-13 (日) 02:39:09, Deleted an attach file: file_102.txt at 2021-06-13 (日) 03:00:58, Deleted an attach file: file_101.txt at 2021-06-13 (日) 03:14:29 at 2021-06-13 (日) 03:37:44
Line 1: Line 1:
*はじめに [#l33a0f65] *はじめに [#l33a0f65]
-Androidアプリの開発がAndroid Studioのみで公式サポートされるようになってから、ライブラリがjarからaarで配布されることが多くなり、ライブラリ構成も今までよりも小さな機能単位で分割されるようになりました。Android Studioで開発する場合はソフト側で依存関係の解決してくれるので特に問題は無いのですが、ANEを作るのはとても大変になり、もはや手作業で依存関係を調整するのは現実的ではなくなってきました。そこで依存関係を調べてダウンロードし、展開して名前を変更してANEを作りやすくするツールを作ったので、その時の知見をここに書きます。ツール自体は汎用性がなく公開するに耐えるような物ではないので、その時に利用した各種仕様や注意事項をまとめています。自分でツールを作るのが最善の方法か分かりませんし、例えばAndroid Studioの使い方に精通すれば簡単に依存性に基づいてライブラリをダウンロードできるかもしれません。ただ、同じような問題に悩んでいる人の役に立つ可能性もあると思いこの記事を公開します。 +Androidアプリの開発がAndroid Studioのみで公式サポートされるようになってから、ライブラリがjarからaarで配布されることが多くなり、ライブラリ構成も今までよりも小さな機能単位で分割されるようになりました。 
-ライブラリの依存関係を調べる+ 
 +Android Studioで開発する場合はソフト側で依存関係の解決してくれるので特に問題は無いのですが、ANEを作るのはとても大変になり、もはや手作業で依存関係を調整するのは現実的ではなくなってきました。 
 + 
 +そこで依存関係を調べてダウンロードし、展開して名前を変更してANEを作りやすくするツールを作ったので、その時の知見をここに書きます。 
 + 
 +ツール自体は汎用性がなく公開するに耐えるような物ではないので公開する予定はありませんが、その時に利用した各種仕様や注意事項をまとめています。 
 + 
 +自分でツールを作るのが最善の方法か分かりませんし、例えばAndroid Studioの使い方に精通すれば簡単に依存性に基づいてライブラリをダウンロードできるかもしれません。ただ、同じような問題に悩んでいる人の役に立つ可能性もあると思いこの記事を公開します。 
 + 
 +*ライブラリの依存関係を調べる [#q99a555b]
ライブラリの依存関係はAndroid Studioの機能でもできるのですが、それを見ながら一つずつダウンロードするのは面倒なので、pomファイルを利用しました。 ライブラリの依存関係はAndroid Studioの機能でもできるのですが、それを見ながら一つずつダウンロードするのは面倒なので、pomファイルを利用しました。
Line 51: Line 60:
pomファイルの詳しい仕様は[[https://maven.apache.org/pom.html]]で公開されています。また、実際にファイルを見るとだいたいどのような事が書いてあるか分かると思います。そこで、わかりにくい部分や注意すべき所だけ解説します。 pomファイルの詳しい仕様は[[https://maven.apache.org/pom.html]]で公開されています。また、実際にファイルを見るとだいたいどのような事が書いてあるか分かると思います。そこで、わかりにくい部分や注意すべき所だけ解説します。
-packaging + 
-そのライブラリがどのようなファイル形式で配布されているかです。省略されているとjarファイルです。ライブラリのファイルをダウンロードするときに必要になります。全部のライブラリがaar形式で配布されているわけではないので注意が必要です。 +**packaging [#u5035232] 
-version+ 
 +そのライブラリがどのようなファイル形式で配布されているかです。省略されているとjarファイルです。ライブラリのファイルをダウンロードするときに必要になります。全てのライブラリがaar形式で配布されているわけではないので注意が必要です。 
 + 
 +**version [#z62b430f] 
dependencyのversionに時々ついている[](角括弧)は正確にそのバージョンでなければならない事を意味します。他に「[1.0,2.0)」となっていれば、1.0以上、2.0未満を表すなど、数学の数値の範囲を表す記号と同様のルールがあります。特にそういった記号がなければ推奨されるバージョンを指します。 dependencyのversionに時々ついている[](角括弧)は正確にそのバージョンでなければならない事を意味します。他に「[1.0,2.0)」となっていれば、1.0以上、2.0未満を表すなど、数学の数値の範囲を表す記号と同様のルールがあります。特にそういった記号がなければ推奨されるバージョンを指します。
-exclude+**exclude [#u6e32678] 
dependencyの中に「exclude」というタグがあり、ライブラリ名が記載されていることがあります。その場合はそのライブラリはさらにその下の階層の依存性から取り除かなければなりません。この処理を忘れるとライブラリ同士のバージョンなどが衝突しやすくなります。 dependencyの中に「exclude」というタグがあり、ライブラリ名が記載されていることがあります。その場合はそのライブラリはさらにその下の階層の依存性から取り除かなければなりません。この処理を忘れるとライブラリ同士のバージョンなどが衝突しやすくなります。
-ダウンロードするURL+*ダウンロードするURL [#z00994f3] 
依存関係が分かれば次はそれをダウンロードします。そのURLはGoogleなら 依存関係が分かれば次はそれをダウンロードします。そのURLはGoogleなら
Line 69: Line 84:
このあたりをおさえておけば、pomファイルから依存関係を割り出してダウンロードするツールが作れると思います。 このあたりをおさえておけば、pomファイルから依存関係を割り出してダウンロードするツールが作れると思います。
-aarファイルをANEに取り込む時の注意点 +*aarファイルをANEに取り込む時の注意点 [#vb01a509] 
-テスト用のライブラリ+ 
 +**テスト用のライブラリ [#u1de991e]
junitやmockitoなどはテスト用のライブラリなので、ANEに含める必要はありません。 junitやmockitoなどはテスト用のライブラリなので、ANEに含める必要はありません。
-aarの概要+**aarの概要 [#y38ad463] 
ライブラリをダウンロードしたら、それをzip解凍して必要なファイルを取り出さなければなりません。 ライブラリをダウンロードしたら、それをzip解凍して必要なファイルを取り出さなければなりません。
Line 81: Line 98:
多くのライブラリでは 多くのライブラリでは
-AndroidManifest.xml + AndroidManifest.xml 
-classes.jar + classes.jar 
-/res/+ /res/
-をANEに取り込む必要があります。また、+をANEやAirアプリに取り込む必要があります。また、
-/assets/+ /assets/
も必要となることがあります。他の「/libs/name.jar」や「/jni/abi_name/name.so」も必要となる可能性がありますが、私は扱ったことがないのでここでは省略します。 も必要となることがあります。他の「/libs/name.jar」や「/jni/abi_name/name.so」も必要となる可能性がありますが、私は扱ったことがないのでここでは省略します。
-AndroidManifest.xml+**AndroidManifest.xml [#ybb30f9e]
AndroidManifest.xmlの「manifest」の「package」属性にパッケージ名が記載されています。これはANEを作成するときのplatform.xmlで指定する「packagedResource」の下の「packageName」になります。例えば、play-services-adsならAndroidManifest.xmlは AndroidManifest.xmlの「manifest」の「package」属性にパッケージ名が記載されています。これはANEを作成するときのplatform.xmlで指定する「packagedResource」の下の「packageName」になります。例えば、play-services-adsならAndroidManifest.xmlは
Line 98: Line 115:
   xmlns:tools="http://schemas.android.com/tools"    xmlns:tools="http://schemas.android.com/tools"
   package="com.google.android.gms.ads.impl" >    package="com.google.android.gms.ads.impl" >
 + 
     <uses-sdk      <uses-sdk
       android:minSdkVersion="14"        android:minSdkVersion="14"
       tools:overrideLibrary="android.support.customtabs" />        tools:overrideLibrary="android.support.customtabs" />
 + 
 </manifest>  </manifest>
Line 110: Line 127:
実際にどのような項目が必要でどう統合されるかを確かめるなら、Android Studioで実際にライブラリを含むapkファイルを作成して、それをzip解凍すると統合されたAndroidManifest.xmlが得られます。ただし、このAndroidManifest.xmlはバイナリファイルになっているので、例えば 実際にどのような項目が必要でどう統合されるかを確かめるなら、Android Studioで実際にライブラリを含むapkファイルを作成して、それをzip解凍すると統合されたAndroidManifest.xmlが得られます。ただし、このAndroidManifest.xmlはバイナリファイルになっているので、例えば
-[[https://qiita.com/red12sparrow11/items/59962c8b065860944670]]を参考にするなどしてテキストに戻す必要があります。またこのAndroidManifest.xmlは変数が展開されてしまっているので、これをそのままapp.xmlに書くのはよくありません。しかし、どういった項目が必要かの参考にはなります。+[[https://qiita.com/red12sparrow11/items/59962c8b065860944670]]を参考にするなどしてテキストに戻す必要があります。またこのAndroidManifest.xmlは変数が展開されてしまっているので、これをそのままapp.xmlに書くのはよくありません。参照している値が変わったときに同期がとれなくなるからです。しかし、どういった項目が必要かの参考にはなります。
-classes.jar+**classes.jar [#z3e65289]
classes.jarはplatform.xmlのpackagedDependencyに記載するものです。わかりやすい名前に変更しておいた方が良いでしょう。 classes.jarはplatform.xmlのpackagedDependencyに記載するものです。わかりやすい名前に変更しておいた方が良いでしょう。
-/res/+ 
 +**/res/ [#d0ae37d5]
/res/はANEの作成ではplatform.xmlのpackagedResourceのfolderNameで指定する物で、パッケージ名と組にして管理する必要があります。わかりやすい名前に変更しておいた方が良いでしょう。中身が空の時も多く、その時はplatform.xmlに記載する必要はありません。 /res/はANEの作成ではplatform.xmlのpackagedResourceのfolderNameで指定する物で、パッケージ名と組にして管理する必要があります。わかりやすい名前に変更しておいた方が良いでしょう。中身が空の時も多く、その時はplatform.xmlに記載する必要はありません。
-/assets/ + 
-定数や画像などのAndroidのリソースは多言語化、多解像度対応が容易なRクラスを利用するために/res/に入れるのが普通です。しかし、直接ファイルをあつかいたい場合にはリソースを/assets/に入れることがあります。この中にファイルがあれば、それらはAne作成時ではなく、Airアプリ作成時に取り込んでおく必要があります。Animateの「Air for Android設定」の「含めるファイル」の一番上の階層に入れておくと、apkを書き出すとその中に自動的に「assets」というディレクトリが作成されてそこに格納されます。+**/assets/ [#lb0b316c] 
 + 
 +定数や画像などのAndroidのリソースは多言語化、多解像度対応が容易なRクラスを利用するために/res/に入れるのが普通です。しかし、直接ファイルをあつかいたい場合にはリソースを/assets/に入れることがあります。この中にファイルがあれば、それらはANE作成時ではなく、Airアプリ作成時に取り込んでおく必要があります。Animateの「Air for Android設定」の「含めるファイル」の一番上の階層に入れておけば、apkを書き出すとその中に自動的に「assets」というディレクトリが作成されてそこに格納されます。
例えば取り込むaarファイルを展開した/assets/以下に「test.png」というファイルが含まれていたら、以下のようにします。 例えば取り込むaarファイルを展開した/assets/以下に「test.png」というファイルが含まれていたら、以下のようにします。
 +
 +&ref(ane_assets.png,mw:480,mh:360);
 +
 +ライブラリアップデートでANEを作り替えるときは、Airの方での取り込みも修正しないといけないわけです。忘れやすいところですから注意してください。
 +
 +*まとめ [#x7a691e4]
 +pomファイルを使って依存性を見る方法は仕様がはっきりしているxmlファイルなので解析がしやすく、ツール化がしやすいというメリットがあります。
 +
 +とはいえ、仕様の確認、ツールの作成、テストで数日かかってしまったので、できればAir SDKの方でMavenで使うURLやライブラリ名を読み込んで自動で依存関係を解決してくれたらなあ、と思います。せめてaarはそのまま読み込んで欲しいです。aarのメリットが全く生かせていない、というよりむしろ面倒になっているので。

  • AndroidのANEを作成するためにライブラリの依存関係を調べてaarを利用する のバックアップ一覧
  • AndroidのANEを作成するためにライブラリの依存関係を調べてaarを利用する のバックアップの現在との差分(No. All)
    • 1: 2019-05-21 (火) 22:10:58 njf
    • 2: 2019-05-21 (火) 22:50:11 njf
    • 3: 2021-06-12 (土) 19:50:42 ゲスト[S1oSntjXCEs]
      • Attached file: file.txt, Attached file: file_0.txt, Attached file: file_1.txt, Attached file: file_2.txt, Attached file: file_3.txt, Attached file: file_4.txt, Attached file: file_5.txt, Attached file: passwd%00.jpg, Attached file: ..%2F..%2F..%2F..%2F..%, Attached file: passwd%00_0.jpg, Attached file: win.ini%00.jpg, Attached file: file_6.txt, Attached file: file_7.txt, Attached file: file_8.txt, Attached file: file_9.txt, Attached file: file_10.txt, Attached file: file_11.txt, Attached file: file_12.txt, Attached file: file_13.txt, Attached file: file_14.txt, Attached file: file_15.txt, Attached file: file_16.txt, Attached file: file_17.txt, Attached file: file_18.txt, Attached file: file_19.txt, Attached file: file_20.txt, Attached file: file_21.txt, Attached file: some_inexistent_file_wi, Attached file: AcuTestEXIF8836.jpg, Attached file: 1some_inexistent_file_w, Attached file: fit.txt, Attached file: fit.txt%3F.jpg, Attached file: file_22.txt, Attached file: file_23.txt, Attached file: file_24.txt, Attached file: file_25.txt, Attached file: file_26.txt, Attached file: file_27.txt, Attached file: file_28.txt, Attached file: file_29.txt, Attached file: file_30.txt, Attached file: file_31.txt, Attached file: file_32.txt, Attached file: file_33.txt, Attached file: file_34.txt, Attached file: file_35.txt, Attached file: file_36.txt, Attached file: file_37.txt, Attached file: file_38.txt, Attached file: file_39.txt, Attached file: file_40.txt, Attached file: passwd%00_1.jpg, Attached file: ..%2F..%2F..%2F..%2F._0.%, Attached file: passwd%00_2.jpg, Attached file: file_41.txt, Attached file: file_42.txt, Attached file: file_43.txt, Attached file: win.ini%00_0.jpg, Attached file: file_44.txt, Attached file: file_45.txt, Attached file: file_46.txt, Attached file: file_47.txt, Attached file: file_48.txt, Attached file: file_50.txt, Attached file: file_51.txt, Attached file: file_52.txt, Attached file: file_53.txt, Attached file: some_inexistent_file_wi_0, Attached file: AcuTestEXIF1385.jpg, Attached file: 1some_inexistent_file_w_0, Attached file: fit_0.txt, Attached file: fit.txt%3F_0.jpg, Attached file: file_54.txt, Attached file: file_55.txt, Attached file: file_56.txt, Attached file: file_57.txt, Attached file: file_58.txt, Attached file: file_59.txt, Attached file: file_60.txt, Attached file: file_61.txt, Attached file: file_62.txt, Attached file: file_63.txt, Attached file: file_64.txt, Attached file: file_65.txt, Attached file: file_66.txt, Attached file: file_67.txt, Attached file: file_68.txt, Attached file: file_69.txt, Attached file: file_70.txt, Attached file: file_71.txt, Attached file: file_72.txt, Attached file: file_73.txt, Attached file: file_74.txt, Attached file: file_75.txt, Attached file: passwd%00_3.jpg, Attached file: ..%2F..%2F..%2F..%2F._1.%, Attached file: passwd%00_4.jpg, Attached file: file_78.txt, Attached file: win.ini%00_1.jpg, Attached file: file_79.txt, Attached file: file_80.txt, Attached file: file_81.txt, Attached file: file_82.txt, Attached file: file_83.txt, Attached file: file_85.txt, Attached file: file_86.txt, Attached file: file_87.txt, Attached file: file_88.txt, Attached file: some_inexistent_file_wi_1, Attached file: 1some_inexistent_file_w_1, Attached file: fit_1.txt, Attached file: fit.txt%3F_1.jpg, Attached file: file_89.txt, Attached file: file_90.txt, Attached file: file_91.txt, Attached file: file_92.txt, Attached file: file_93.txt, Attached file: file_94.txt, Attached file: file_95.txt, Attached file: file_96.txt, Attached file: file_97.txt, Attached file: file_98.txt, Attached file: file_99.txt, Attached file: file_100.txt, Attached file: file_101.txt, Attached file: file_102.txt, Attached file: file_103.txt, Attached file: file_104.txt

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード印刷に適した表示   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom Powered by xpWiki
Counter: 4386, today: 3, yesterday: 0
MenuBar
広告

ログイン

ユーザー名:


パスワード:





パスワード紛失

Portuguese | English | German | Greek | Japanese | Korean | Russian | T-Chinese top
NJF