Some file crunching failed
Android Studioを2.3に改版すると下記のエラーが発生した。
Information:Gradle tasks [clean, :(省略):generateDebugSources, :(省略):generateDebugAndroidTestSources, :(省略):mockableAndroidJar, :(省略):prepareDebugUnitTestDependencies, :(省略):compileDebugSources, :(省略):compileDebugAndroidTestSources, :(省略):compileDebugUnitTestSources, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources]
15:54:20.374 [ERROR] [org.gradle.api.Project] AAPT err(Facade for 727369730): \\?\C:\Users\漢字\.android\build-cache\91d4fc3623f1db2e13d9719feb5cd41e8a96b0c9\output\res\drawable-xxhdpi-v4\googleg_standard_color_18.png ERROR: Unable to open PNG file
解答は次のサイトを参照してください。
http://stackoverflow.com/questions/42580645/errorsome-file-crunching-failed-see-logs-for-details-afer-update-gradle
原因:Windowsにおけるフォルダーの名前に2バイト文字を使用していたため。
解決方法:プロジェクトのルートにあるgradle.propertiesファイル内に、次の1行を書きこんでください。
android.enableBuildCache=false
又は、上記の値をtrueにした上で、ASCII文字だけで構成されるフォルダー名を下記のように設定します。
android.buildCacheDir=C:/akan-mata-bagu-ya/build-cache
2017年3月8日水曜日
2016年1月22日金曜日
MountService No primary storage defined yet hacking together a stub
MountService No primary storage defined yet hacking together a stub
Android 6.0のエミュレータで上記のエラーが発生します。
これが原因で他のアプリが動かなくなります。
解決方法は、このエラーが発生するエミュレータを捨てて、Android Virtual Device Managerで新規にエミュレータを作成してください。残念です。
Android 6.0のエミュレータで上記のエラーが発生します。
これが原因で他のアプリが動かなくなります。
解決方法は、このエラーが発生するエミュレータを捨てて、Android Virtual Device Managerで新規にエミュレータを作成してください。残念です。
2015年11月19日木曜日
.InstantiationException
InstantiationException
E/AndroidRuntime: Caused by: java.lang.InstantiationException: java.lang.Class<xxxx.xxxx.xxxx> cannot be instantiated
上記のエラーが出ました。原因は、下記のように、abstractが付いてしまっていたためでした。これを消すと直りました。何かの拍子に自動的に付加されてしまったものです。
public abstract class MainActivity extends Activity
参考
java.lang.InstantiationException: can't instantiate class; no empty constructor
E/AndroidRuntime: Caused by: java.lang.InstantiationException: java.lang.Class<xxxx.xxxx.xxxx> cannot be instantiated
上記のエラーが出ました。原因は、下記のように、abstractが付いてしまっていたためでした。これを消すと直りました。何かの拍子に自動的に付加されてしまったものです。
public abstract class MainActivity extends Activity
参考
java.lang.InstantiationException: can't instantiate class; no empty constructor
2015年11月4日水曜日
Resources: Converting to string: TypedValue
Resources: Converting to string: TypedValue
W/Resources: Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x1020351}
上記のような警告がLogに表示されることがあります。
この警告が不要であれば、Android端末の「設定」>「開発者向けオプション」>「表示属性検査を有効にする」のチェックを外してください。
W/Resources: Converting to string: TypedValue{t=0x12/d=0x0 a=1 r=0x1020351}
上記のような警告がLogに表示されることがあります。
この警告が不要であれば、Android端末の「設定」>「開発者向けオプション」>「表示属性検査を有効にする」のチェックを外してください。
2015年11月3日火曜日
MiniThumbFile: Unable to create .thumbnails directory
MiniThumbFile: Unable to create .thumbnails directory
Android 6.0で上記エラーが発生しました。
AndroidManifest.xmlファイルに下記のとおり追記すると解決しました。
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Android 6.0で上記エラーが発生しました。
AndroidManifest.xmlファイルに下記のとおり追記すると解決しました。
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
参考
2015年10月10日土曜日
google.android.gms.ads.AdActivity
google.android.gms.ads.AdActivity
google.android.gms.ads.AdActivityを使用しない場合(Admobの広告を使用しない場合)であっても、
\app\build\intermediates\manifests\full\debug\AndroidManifest.xmlファイルの下方には、次のように自動的に記載される。何故このような仕様にしているのかは問わない。
<!-- Include the AdActivity and InAppPurchaseActivity configChanges and themes. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<activity
android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
android:theme="@style/Theme.IAPTheme" />
google.android.gms.ads.AdActivityを使用しない場合(Admobの広告を使用しない場合)であっても、
\app\build\intermediates\manifests\full\debug\AndroidManifest.xmlファイルの下方には、次のように自動的に記載される。何故このような仕様にしているのかは問わない。
<!-- Include the AdActivity and InAppPurchaseActivity configChanges and themes. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<activity
android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
android:theme="@style/Theme.IAPTheme" />
普段は人畜無害なので冬眠中の虫のようなものだ。
しかし、この記述内のandroid:configChangesの記載にエラーがあるという趣旨で、Build>Rebuild Projectの時、及びGenerate Signed APK...の時にエラーが発生した、
止むを得ないので、gms系のを全部削除した。
すると、新たなエラーが発生した。
gms系のエラーは真の原因では無く、闇の大ボスがいるようである。むむむ!
そこで、Proguardの設定ファイル内に次の行を書き込んでみた。
Androidのプログラミングの難易度は結構高めです。
すると、新たなエラーが発生した。
gms系のエラーは真の原因では無く、闇の大ボスがいるようである。むむむ!
そこで、Proguardの設定ファイル内に次の行を書き込んでみた。
-dontwarn com.google.android.gms.**
すると、闇の大ボスは出なくなった。
gmsを使ってないのに!!!
Androidのプログラミングの難易度は結構高めです。
2015年6月8日月曜日
Could not reserve enough space for object heap
以前下記のような趣旨のエラーが出たように記憶しており、その回避のために、Android Studio>File>Settings>Build Tools>Compiler>VM Options欄にheapサイズを大きくすべく -Xmx????m などと書いた。
しかしながら、また、下記のエラーが出た。今回は、VM Options欄を空欄にしてみた。そうすれば、エラーは無くなった。むむむ!
そして、その後また同様のエラーが発生した。
-Xmx512m と書くとエラーが無くなった。数値が大きければ良いというものでは無いらしい。
Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
その後、Android Studioが1.3になると、VM Options欄が消失していた。いままでの苦労はなんだったんだろうか。
2015/08/08 また出てしまった。
Error:Unable to start the daemon process: could not reserve enough space for object heap.
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
しかしながら、また、下記のエラーが出た。今回は、VM Options欄を空欄にしてみた。そうすれば、エラーは無くなった。むむむ!
そして、その後また同様のエラーが発生した。
-Xmx512m と書くとエラーが無くなった。数値が大きければ良いというものでは無いらしい。
Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
その後、Android Studioが1.3になると、VM Options欄が消失していた。いままでの苦労はなんだったんだろうか。
2015/08/08 また出てしまった。
Error:Unable to start the daemon process: could not reserve enough space for object heap.
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
Windowsを再起動したり、Android Studioを再起動したりすると、このエラーは消える。むむむ!
2015/08/13 また出てしまった。Android Studio 1.3.1
Error:Unable to start the daemon process: could not reserve enough space for object heap.
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
org.gradle.jvmargs=-Xmx1024m
2015/08/27 また同じのが出てしまった。Android Studio 1.3.2
Error:Unable to start the daemon process: could not reserve enough space for object heap.
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
org.gradle.jvmargs=-Xmx1024m
Windowsを再起動すれば直るため、このエラーメッセージの内容は参考程度ですね。
2016/01/05 Android Studio 1.5.1
この問題は、Android Studio の問題では無く、Windowsが発生させているようです。
上記のように、オプション欄にいろいろ数値を代入していじくっても解決しません。
よく発生するのは、Windowsのシステムアップデートの時です。事前に、Windowsのシステムアップデートをしっかり定着させておきましょう。
それでも、本日は、頻繁に発生してしまいました。Windowsのいわゆる「起動マネージャ」を使い、Windowsの起動時に起動されてしまうアプリを見直してみましょう。私の場合、この確認行為をしただけで、実際には何も変更を加えていないにも関わらず、Android studioの問題が消失しました。むむむ。
2015/08/13 また出てしまった。Android Studio 1.3.1
Error:Unable to start the daemon process: could not reserve enough space for object heap.
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
org.gradle.jvmargs=-Xmx1024m
2015/08/27 また同じのが出てしまった。Android Studio 1.3.2
Error:Unable to start the daemon process: could not reserve enough space for object heap.
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
org.gradle.jvmargs=-Xmx1024m
Windowsを再起動すれば直るため、このエラーメッセージの内容は参考程度ですね。
2016/01/05 Android Studio 1.5.1
この問題は、Android Studio の問題では無く、Windowsが発生させているようです。
上記のように、オプション欄にいろいろ数値を代入していじくっても解決しません。
よく発生するのは、Windowsのシステムアップデートの時です。事前に、Windowsのシステムアップデートをしっかり定着させておきましょう。
それでも、本日は、頻繁に発生してしまいました。Windowsのいわゆる「起動マネージャ」を使い、Windowsの起動時に起動されてしまうアプリを見直してみましょう。私の場合、この確認行為をしただけで、実際には何も変更を加えていないにも関わらず、Android studioの問題が消失しました。むむむ。
2015年4月19日日曜日
無料版の構築エラー
無料版の構築エラー
1個のプロジェクトで、無料版と有料版を構築している。
無料版のデバッグをしようとして、実行をさせようとするが、「無料版の実行形式ファイルがありません」という趣旨のエラーが出る。
そうすると、普通は、無料版関係について、あれこれイジリ回しますよね。
この場合、たぶん、有料版の実行形式ファイルが存在しないのである。このため、有料版の実行形式ファイルを、Build>Clean Projectコマンドを使って作れば良い。
そうすれば、無料版のデバッグができる。むむむ!
開発環境:Android Studio
1個のプロジェクトで、無料版と有料版を構築している。
無料版のデバッグをしようとして、実行をさせようとするが、「無料版の実行形式ファイルがありません」という趣旨のエラーが出る。
そうすると、普通は、無料版関係について、あれこれイジリ回しますよね。
この場合、たぶん、有料版の実行形式ファイルが存在しないのである。このため、有料版の実行形式ファイルを、Build>Clean Projectコマンドを使って作れば良い。
そうすれば、無料版のデバッグができる。むむむ!
開発環境:Android Studio
2015年4月13日月曜日
AndroidLintIconMissingDensityFolder
AndroidLintIconMissingDensityFolder
Android Studio>Analyze>Inspect Code...
下記のエラーが出ることが有る。
AndroidLintIconMissingDensityFolder
Missing density folder
Icons will look best if a custom version is provided for ...
解決方法
主モジュール及び副モジュール(ライブラリ)の両方のresフォルダーに下記7個のフォルダーをダミーで設ければ良い。
drawable
mipmap-hdpi
mipmap-ldpi
mipmap-mdpi
mipmap-xhdpi
mipmap-xxhdpi
mipmap-xxxhdpi
drawable-*系のフォルダーは削除しても良い。
ライブラリ側のresフォルダーにもダミーで設けるってことが肝要ですね。
画像ファイルは入れておかなくても良い。
これに伴い、主モジュールのAndroidManifest.xmlのアイコンに関して次のように書き換えます。
android:icon="@mipmap/ic_launcher"
ちなみに、「mipmap」では無く「drawable」で置き換えた場合、別途、「アイコンのサイズが異なります」という趣旨のエラーが発生します。
Android Studio>Analyze>Inspect Code...
下記のエラーが出ることが有る。
AndroidLintIconMissingDensityFolder
Missing density folder
Icons will look best if a custom version is provided for ...
解決方法
主モジュール及び副モジュール(ライブラリ)の両方のresフォルダーに下記7個のフォルダーをダミーで設ければ良い。
drawable
mipmap-hdpi
mipmap-ldpi
mipmap-mdpi
mipmap-xhdpi
mipmap-xxhdpi
mipmap-xxxhdpi
drawable-*系のフォルダーは削除しても良い。
ライブラリ側のresフォルダーにもダミーで設けるってことが肝要ですね。
画像ファイルは入れておかなくても良い。
これに伴い、主モジュールのAndroidManifest.xmlのアイコンに関して次のように書き換えます。
android:icon="@mipmap/ic_launcher"
ちなみに、「mipmap」では無く「drawable」で置き換えた場合、別途、「アイコンのサイズが異なります」という趣旨のエラーが発生します。
2015年4月10日金曜日
image varies significantly
image varies significantly
放置しても問題は無いようである。
解決方法としては、Android Studioにおいて、空のプロジェクトを新規に生成して、そこにあるresourceのdrawableフォルダーにあるファイル関係を参考にしながら、自分のアプリのプロジェクトを構築すれば良い。例えば、mipmap-hdpiという名前のフォルダーを作成して、そこに画像ファイルを入れれば良い。
AndroidManifest.xml内の、アイコンを使用しているフォルダー名も書き換えることになる。
(参考)
Image varies significantly in its density-independent (dip) size
The image *.png varies significantly in its density-independent (dip) size across the various density versions多分、EclipseからAndroid Studioにプロジェクトを移植した場合、上記の文言がinspection resultとして表示されるかもしれない。
放置しても問題は無いようである。
解決方法としては、Android Studioにおいて、空のプロジェクトを新規に生成して、そこにあるresourceのdrawableフォルダーにあるファイル関係を参考にしながら、自分のアプリのプロジェクトを構築すれば良い。例えば、mipmap-hdpiという名前のフォルダーを作成して、そこに画像ファイルを入れれば良い。
AndroidManifest.xml内の、アイコンを使用しているフォルダー名も書き換えることになる。
(参考)
Image varies significantly in its density-independent (dip) size
2015年4月9日木曜日
恐怖のPower Save Mode
恐怖のPower Save Mode
Android Studioのエディタにおいて、赤色のエラーが表示されなくなった。原因不明で、アンインストールを2回行い、Settings...を何度も見直し、問題解決を試みたが解決しなかった。
原因はFile->Power Save Modeであった。これにチェックしていると、赤色のエラーが表示されなくなる。
Android Studioはコマンド数が多すぎる。Power Save Modeは削除して欲しい。
Android Studioのエディタにおいて、赤色のエラーが表示されなくなった。原因不明で、アンインストールを2回行い、Settings...を何度も見直し、問題解決を試みたが解決しなかった。
原因はFile->Power Save Modeであった。これにチェックしていると、赤色のエラーが表示されなくなる。
Android Studioはコマンド数が多すぎる。Power Save Modeは削除して欲しい。
2015年3月29日日曜日
proguard dontwarn
proguard dontwarn
下記の趣旨のエラーが出た。
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: there were 21 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:proguardRelease FAILED
下記の趣旨のエラーが出た。
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: there were 21 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:proguardRelease FAILED
対処方法
次の1行だけを記述したテキストファイルを適当なファイル名(ここでは'my_proguard-project.txt')で、(ルートでは無く)モジュール側のフォルダーに作成する。
-dontwarn sun.misc.Unsafe
(ルートでは無く)モジュール側のbuild.gradleファイルに次のように書く。
buildTypes{release{minifyEnabled true//プロガードを実行するproguardFile getDefaultProguardFile('proguard-android.txt')proguardFile file('my_proguard-project.txt')}
getDefaultProguardFile()は${sdk.dir}/tools/proguard/proguard-android.txtを自動的に読み込む。
my_proguard-project.txtは、このプロジェクトのモジュール固有のproguard設定です。
ちなみに、デフォルトでは、minifyEnabledはfalseです。
(参考)Android Tools Project Site
ちなみに、デフォルトでは、minifyEnabledはfalseです。
(参考)Android Tools Project Site
2014年12月20日土曜日
NullPointerException TimePicker.updateInputState
FATAL EXCEPTION: main
Process: XXXXXXXX, PID: 8966
java.lang.NullPointerException
at android.widget.TimePicker.updateInputState(TimePicker.java:695)
原因は不正確かもしれませんが、setVisibility(View.GONE)をアプリ開始時に適用したためではないかと推測しています。
Process: XXXXXXXX, PID: 8966
java.lang.NullPointerException
at android.widget.TimePicker.updateInputState(TimePicker.java:695)
Android 4.x系において、TimePickerを表示&操作すると上記エラーが発生する。
原因は不正確かもしれませんが、setVisibility(View.GONE)をアプリ開始時に適用したためではないかと推測しています。
ThemeをHolo又は無しに設定すれば上記エラーを回避することはできるが、見た目が不細工になり、不細工すぎて、端末利用者はTimePickerを操作できない。
Themeの変更により、上記エラーが回避できるということはバグが原因であろうと思います。今からでも遅くはないので直して欲しいです。
(参考)
2014年12月7日日曜日
Error inflating class fragment
Error inflating class fragment
回答は次のサイトに掲載されています。複数の原因があるということですね。
Error inflating class fragment
私の場合は、onCreateViewメソッドの時点において、activityを操作しようとしたため上記エラーが発生しました。
onAttachメソッドの時点においてactivityを取得できるため、onAttachメソッド以降はactivityを操作できると思い込みました。
正しくは、onActivityCreatedメソッド以降でactivityを取得&操作するようにしなければならないということですね。
では、何故onAttachメソッドの時点においてactivityが取得できてしまうのかは疑問が残る。
回答は次のサイトに掲載されています。複数の原因があるということですね。
Error inflating class fragment
私の場合は、onCreateViewメソッドの時点において、activityを操作しようとしたため上記エラーが発生しました。
onAttachメソッドの時点においてactivityを取得できるため、onAttachメソッド以降はactivityを操作できると思い込みました。
正しくは、onActivityCreatedメソッド以降でactivityを取得&操作するようにしなければならないということですね。
では、何故onAttachメソッドの時点においてactivityが取得できてしまうのかは疑問が残る。
2013年12月22日日曜日
SDK Managerでインストールエラー
EclipseのAndroid SDK Managerで任意のSDK Platformをインストール(アップデート)しようとした場合、「フォルダーが使用中であるか、又はウイルスソフトを停止せよ」という趣旨のエラーメッセージが出ることがあるかもしれません。
私の場合は、
1.Package Exploler画面を表示し、開いているプロジェクトを全て閉じて、
2.Eclipseを再起動する
と、無事にインストールができました。
私の場合は、
1.Package Exploler画面を表示し、開いているプロジェクトを全て閉じて、
2.Eclipseを再起動する
と、無事にインストールができました。
2013年11月30日土曜日
YouTubeService has leaked
バージョンが5.3.24のYouTubeにおいて、YouTube API Demosで、PlayerViewDemoActivity("Simple PlayerView")を起動し、そしてこのActivityを終了させると、次のログが出力される。アプリの動作には問題はない。原因は不明です。
E/ActivityThread(3632): Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver com.google.android.apps.youtube.core.utils.ConnectivityReceiver@424ccd10 that was originally registered here. Are you missing a call to unregisterReceiver()?
E/ActivityThread(3632): android.app.IntentReceiverLeaked: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver com.google.android.apps.youtube.core.utils.ConnectivityReceiver@424ccd10 that was originally registered here. Are you missing a call to unregisterReceiver()?
YouTubeのバージョンの取得方法
String s = YouTubeIntents.getInstalledYouTubeVersionName(getBaseContext());
Log.d("PlayerViewDemoActivity", "Installed YouTube Version==" + s);
Installed YouTube Version==5.3.24 (2013/11/30)
対応方法(案)
不都合が生じるYouTubeのバージョンをアプリ開発者が相互に報告しあって、不都合が生じるバージョンのYouTubeがインストールされている場合、アプリの振る舞いを工夫する。例えば、起動を中止する。
地味な対応策だな。
Android player crashes when on attempt to play and ads videoによると、YouTubeのバージョンが、
5.2.27
5.3.23
において不都合が発生しているようである。
2014.01.23: YouTubeのversionが5.3.32の場合も上記不都合が発生することを確認しました。
2014.03.15: YouTubeのversionが5.5.27の場合も上記不都合が発生することを確認しました。
2014.04.20: YouTubeのversionが5.6.32の場合も上記不都合が発生することを確認しました。
2014.05.04: YouTubeのversionが5.6.35の場合も上記不都合が発生することを確認しました。
2014.05.09: YouTubeのversionが5.6.36の場合も上記不都合が発生することを確認しました。
(参考)
Various crashes using Android YouTube Player API
E/ActivityThread(3632): Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver com.google.android.apps.youtube.core.utils.ConnectivityReceiver@424ccd10 that was originally registered here. Are you missing a call to unregisterReceiver()?
E/ActivityThread(3632): android.app.IntentReceiverLeaked: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver com.google.android.apps.youtube.core.utils.ConnectivityReceiver@424ccd10 that was originally registered here. Are you missing a call to unregisterReceiver()?
YouTubeのバージョンの取得方法
String s = YouTubeIntents.getInstalledYouTubeVersionName(getBaseContext());
Log.d("PlayerViewDemoActivity", "Installed YouTube Version==" + s);
Installed YouTube Version==5.3.24 (2013/11/30)
対応方法(案)
不都合が生じるYouTubeのバージョンをアプリ開発者が相互に報告しあって、不都合が生じるバージョンのYouTubeがインストールされている場合、アプリの振る舞いを工夫する。例えば、起動を中止する。
地味な対応策だな。
Android player crashes when on attempt to play and ads videoによると、YouTubeのバージョンが、
5.2.27
5.3.23
において不都合が発生しているようである。
2014.01.23: YouTubeのversionが5.3.32の場合も上記不都合が発生することを確認しました。
2014.03.15: YouTubeのversionが5.5.27の場合も上記不都合が発生することを確認しました。
2014.04.20: YouTubeのversionが5.6.32の場合も上記不都合が発生することを確認しました。
2014.05.04: YouTubeのversionが5.6.35の場合も上記不都合が発生することを確認しました。
2014.05.09: YouTubeのversionが5.6.36の場合も上記不都合が発生することを確認しました。
(参考)
Various crashes using Android YouTube Player API
2013年10月19日土曜日
TimePicker NullPointerException on ICS
TimePicker NullPointerException on ICS
下記のエラーが発生した。
E/AndroidRuntime(13629): FATAL EXCEPTION: main
E/AndroidRuntime(13629): java.lang.NullPointerException
E/AndroidRuntime(13629): at android.widget.TimePicker.updateInputState(TimePicker.java:580)
(以下省略)
このエラーの発生に再現性は無い。
質疑応答は下記のとおり。
TimePicker NullPointerException on ICS
TimePicker.javaの580行目近辺は次のようになっている。
565 private void More ...updateInputState() {
566 // Make sure that if the user changes the value and the IME is active
567 // for one of the inputs if this widget, the IME is closed. If the user
568 // changed the value via the IME and there is a next input the IME will
569 // be shown, otherwise the user chose another means of changing the
570 // value and having the IME up makes no sense.
571 InputMethodManager inputMethodManager = InputMethodManager.peekInstance();
572 if (inputMethodManager != null) {
573 if (inputMethodManager.isActive(mHourSpinnerInput)) {
574 mHourSpinnerInput.clearFocus();
575 inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
576 } else if (inputMethodManager.isActive(mMinuteSpinnerInput)) {
577 mMinuteSpinnerInput.clearFocus();
578 inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
579 } else if (inputMethodManager.isActive(mAmPmSpinnerInput)) {
580 mAmPmSpinnerInput.clearFocus();
581 inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
582 }
583 }
下記のエラーが発生した。
E/AndroidRuntime(13629): FATAL EXCEPTION: main
E/AndroidRuntime(13629): java.lang.NullPointerException
E/AndroidRuntime(13629): at android.widget.TimePicker.updateInputState(TimePicker.java:580)
(以下省略)
このエラーの発生に再現性は無い。
質疑応答は下記のとおり。
TimePicker NullPointerException on ICS
TimePicker.javaの580行目近辺は次のようになっている。
565 private void More ...updateInputState() {
566 // Make sure that if the user changes the value and the IME is active
567 // for one of the inputs if this widget, the IME is closed. If the user
568 // changed the value via the IME and there is a next input the IME will
569 // be shown, otherwise the user chose another means of changing the
570 // value and having the IME up makes no sense.
571 InputMethodManager inputMethodManager = InputMethodManager.peekInstance();
572 if (inputMethodManager != null) {
573 if (inputMethodManager.isActive(mHourSpinnerInput)) {
574 mHourSpinnerInput.clearFocus();
575 inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
576 } else if (inputMethodManager.isActive(mMinuteSpinnerInput)) {
577 mMinuteSpinnerInput.clearFocus();
578 inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
579 } else if (inputMethodManager.isActive(mAmPmSpinnerInput)) {
580 mAmPmSpinnerInput.clearFocus();
581 inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
582 }
583 }
このコードを読むと、午前午後スピナーがnullであったと想定される。
このため、TimePicker#setIs24HourView (Boolean is24HourView)を必ず使わねばならない、と言えるのではないだろうか。エラーが発生した私のコードでは、午前午後スピナーの使用の有無について明記していなかった。
見本は次のとおり。
tp.setIs24HourView(false);
tp.setCurrentHour(iHour);
tp.setCurrentMinute(iMinute);
上記コードにおいて、setCurrentHourメソッドの引数に12-23の値を代入した場合、午前午後スピナーには午後と表示され、時間は0-11で表示される。
2013年7月1日月曜日
ClassNotFoundException
RuntimeException: Unable to instantiate activity ComponentInfo java.lang.ClassNotFoundException in loader dalvik.system.PathClassLoader
ActionBar.OnNavigationListener(Added in API level 11, HONEYCOMB, Android 3.0)の実装について、これはinterfaceであるからして、Activityにinterfaceとしてimplementsしていました。
Android4.2で稼働させるには問題はありませんでした。
ところが、このアプリをAndroid2.3で実行させると、onCreate()が実行されることなく、上記エラーが発生します。
この実装をanonymousにしたところ、Android2.3でも稼働することができました。
こんなふうなanonymousの使い方ってあるのですね。
(参考)
Action Bar
ActionBar.OnNavigationListener(Added in API level 11, HONEYCOMB, Android 3.0)の実装について、これはinterfaceであるからして、Activityにinterfaceとしてimplementsしていました。
Android4.2で稼働させるには問題はありませんでした。
ところが、このアプリをAndroid2.3で実行させると、onCreate()が実行されることなく、上記エラーが発生します。
この実装をanonymousにしたところ、Android2.3でも稼働することができました。
こんなふうなanonymousの使い方ってあるのですね。
(参考)
Action Bar
2013年6月11日火曜日
ClassCastException android.widget.* cannot be cast to android.widget.*
ClassCastException android.widget.* cannot be cast to android.widget.*
下記のエラーが出た。
具体例1.java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.Button
具体例1.java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.Button
具体例2.java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.Button
私が遭遇した上記エラーのViewの階層構造の概念図は次のとおりである。
<LinearLayout> parent
<LinearLayout> child
<Button> has it's original ID.
<LinearLayout> parentの場所から、ButtonのIDをfindViewById()を使って指定して、そのButtonを使うことはできるし、エラーは発生しなかった。アプリに1個しか存在しないIDの値を使うのであるから問題はない。
この方法で以前は問題なく動作していたが、原因は不明であるが、ある時点以降、ButtonのIDを指定すると、「それはImageViewなのでButtonにcastすることはできない」という趣旨のエラーが出て、アプリがクラッシュするようになった。エラー発生箇所によっては、ImageViewではなく、LinearLayoutであったりTextViewであったりした。XMLやIDを調べたが、ButtonはButtonであった。しかしながら、ImageViewであるとされるIDの値は、ButtonのIDの値と同一なのである。このImageViewは私には身に覚えのないViewだ。変だね。
そこで、日本人が得意とするゲーム感覚で、<LinearLayout> childの場所から、つまり、Buttonの直接上のViewから、ButtonのIDを指定して使ったところ、問題無く動作するようになった。
非論理的不都合には、非論理的対応をするのが良いのかもしれない。むむむ!
なお、<LinearLayout> childでは、addView()やremoveAllViews()を使って、その内部にViewを実行時に加えたり削除したりしていた。
leaked ServiceConnection
Activity <App Name> has leaked ServiceConnection <ServiceConnection Name>@ that was originally bound here
対策としてはAnswersの<3>と<8>に書かれてあるが、この対策が真実であるのか私は疑問に感じた。ので、他の方法を模索した。が、成功しなかった。
結局、対策は、Answersの<3>と<8>に書かれてあるように、unbindService()をonDestroy()で行っているのであれば、そのbindService()はonCreate()で行わねばならない、ということであった。
このような対応策が非論理的であると感じてしまうのは、果たして私だけだろうか。。。。(あんた、だけや!)。。。むむむ!
このエラーに関しては次のサイトで議論されている。
実行順序は次のとおりである。
- onDestroy()....前のActivityが実行したonDestroy()
- unbindService()
- 上記エラーログ
- onUnbind()....Service
- onDestroy()....Service
- onCreate()....次のActivityが実行したonCreate()
対策としてはAnswersの<3>と<8>に書かれてあるが、この対策が真実であるのか私は疑問に感じた。ので、他の方法を模索した。が、成功しなかった。
結局、対策は、Answersの<3>と<8>に書かれてあるように、unbindService()をonDestroy()で行っているのであれば、そのbindService()はonCreate()で行わねばならない、ということであった。
このような対応策が非論理的であると感じてしまうのは、果たして私だけだろうか。。。。(あんた、だけや!)。。。むむむ!
登録:
投稿 (Atom)