Android Studio Flamingo 🐦 で Retrofit が「r8 java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType」

はい、でました。


r8 java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType

開発環境が変化した時におこる minify / proguard まわりのエラーは面倒ですね😭

 

🐦 R8 full mode がデフォルトに

そのままで「R8 full mode」だそうです。

R8 full mode by default

The last behavior change: R8 is now in full mode by default, enabling app size reductions and performance improvement. You shouldn’t need to update anything for this change, but if you encounter build or runtime failures you should double-check that your keep rules are configured correctly. For guidance on how to configure the keep rules, see Shrink, obfuscate, and optimize your app.

👉 Shrink, obfuscate, and optimize your app  |  Android Studio  |  Android Developers hatena-bookmark
👉 5 ways to prepare your app build for Android Studio Flamingo release | by Boris Farber | Android Developers | Apr, 2023 | Medium hatena-bookmark

R8 がより強く広く効いて不具合を起こす、ってことか。

 

🐦 解決方法

以下を proguard-rules.pro に追加します。Retrofit 公式に載ってました。


# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items). 
-keep,allowobfuscation,allowshrinking interface retrofit2.Call 
-keep,allowobfuscation,allowshrinking class retrofit2.Response 
  
# With R8 full mode generic signatures are stripped for classes that are not 
# kept. Suspend functions are wrapped in continuations where the type argument 
# is used. 
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

👉 After enable R8 full mode getting ParameterizedType error · Issue #3751 · square/retrofit hatena-bookmark

まずは、ひとつ解決できました。

いろいろありそうです、Flamingo。


Android Studio Flamingo | 2022.2.1 安定版公開される

更新の通知が来たので入れてみました。

👉 Android Developers Blog: Android Studio Flamingo is stable hatena-bookmark
👉 Android Studio Flamingo | 2022.2.1  |  Android Developers hatena-bookmark

しかし、UIデザインはそのままでした。楽しみにしてたのに。


👉 【Android Studio】Giraffe や Flamingo の New UI がシンプルで素晴らしい件 hatena-bookmark
👉 New UI | IntelliJ IDEA Documentation hatena-bookmark

設定画面から「New UI」は消えている。

しかし、適用する方法はある。


👉 Android Studio Flamingo 隠された新デザイン「New UI」を有効化する2つの方法 🐦 hatena-bookmark



OpenAI ChatGPT の API_KEY を取得する方法

アカウント作成している方は取得できます。

以下のリンクにアクセスしてコピーです。

👉 Account API Keys - OpenAI API hatena-bookmark

OpenAI ChatGPT の API_KEY を取得する

あとは必要とする入力欄にペーストすればOKです。



【OpenAI/ChatGPT】API リクエストしたら「You exceeded your current quota, please check your plan and billing details.」

無料で3ヶ月間、18ドル分使えるというので。


openai.api_key = os.getenv("OPENAI_API_KEY")
try:
  response = openai.Completion.create(
    engine="davinci",
    # engine="gpt-3.5-turbo",
    prompt="Hello, world!",
    max_tokens=5
  )
  print(response.choices[0].text)
except Exception as e:
  print(f"{e=}, {type(e)=}")

NGでした。


e=RateLimitError(message='You exceeded your current quota, please check your plan and billing details.', http_status=429, request_id=None), type(e)=<class 'openai.error.RateLimitError'>

利用量の確認をします。

Below you'll find a summary of API usage for your organization. All dates and times are UTC-based, and data may be delayed up to 5 minutes.
👉 Account - OpenAI API hatena-bookmark

利用の記録はないです。

無料18ドル分も付与されてない雰囲気。

「アカウント作成から3ヶ月以内。」ということですがそれは満たしている。

どういうことなんすかね!?

👉 How can I get Free Trial Credits? - General API discussion - OpenAI API Community Forum hatena-bookmark


Google Photos 6.23.1 for iOS 16.3.1 Released now!!

Multiple reports on social media complain about the issue, which The Verge also highlighted. It appears that the Google Photos app is crashing instantly when iPhone and iPad users attempt to open it after upgrading to the latest software.

👉 iOS 16.3.1 Breaks Google Photos App | MacRumors Forums hatena-bookmark


Google is aware of the issue, and is “in the process of rolling out a fix in version 6.23.1 of the Google Photos app,” according Michael Marconi, a spokesperson for the company.

Update February 14th, 12:46AM ET: Added statement from Google.

👉 If Google Photos is broken for you on iOS, you’re not alone - The Verge hatena-bookmark

 

■ 2023-02-14 19:30 JST Fixed version appeared.


Version 6.23.1 

No crashed!! 🆗😁

👉 Google Photos on the App Store hatena-bookmark