apple / apple/app-store-server-library-java

Cannot resolve symbol 'Environment' when importing from com.apple.itunes.storekit.model

オープン
#257 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
276
フォーク
63
平均マージ
4時間 35分
マージ済み PR(30日)
10

説明

I'm trying to use the `Environment` enum from the official `app-store-server-library` (v5.1.1) in a Java project. However, the IDE reports `Cannot resolve symbol 'Environment'` no matter which import statement I try:

- `import com.apple.itunes.storekit.Environment;`
- `import com.apple.itunes.storekit.model.Environment;`

I have checked the library source JAR and found that inside the `model` directory, there is an `Environment.class` file (see attached screenshot). The class seems to exist, but the IDE cannot locate it.

**Steps to reproduce:**
1. Add dependency to `pom.xml` (or `build.gradle`):
```xml

com.apple.itunes.storekit
app-store-server-library
5.1.1

```
2. Run `mvn clean install` (or `gradle build`).
3. In a Java class, try to import `Environment` as shown above.
4. Observe compilation error: `Cannot resolve symbol 'Environment'`.

**What I've tried so far:**
- Invalidating IDE caches and restarting.
- Deleting `.idea` and `.iml` files and re-importing the project.
- Deleting the local Maven repository folder (`~/.m2/repository/com/apple/itunes/storekit/app-store-server-library`) and re-downloading.
- Checking `mvn dependency:tree` – no version conflicts.
- Trying both `5.2.0` and `5.1.1` – same issue.
- Manually verifying the JAR with `jar tf` – the output includes `com/apple/itunes/storekit/model/Environment.class`.
- Using the fully qualified class name `com.apple.itunes.storekit.model.Environment` – still unresolved.

**Expected behavior:**
The class `Environment` should be resolvable by the IDE and compiler without errors.

**Additional notes:**
- The library is correctly downloaded to the local repository.
- Other classes from the same package (e.g., `ReceiptUtility`, `SignedDataVerifier`) are resolvable without issues.
- My JDK version is **11** (or higher), which meets the library's requirement.

**Screenshot attached:** Shows the `model` directory contains `Environment.class` but the IDE cannot find it.

Thank you for your help.

Image

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、説明されている pom.xml または build.gradle の設定を使用して、バージョン 5.1.1 の依存関係 app-store-server-library-java でインポートに失敗することを再現します。JAR エントリ com/apple/itunes/storekit/model/Environment.class を調査し、Java のインポートで使用されているパッケージと比較します。クリーンな Maven または Gradle のビルドで、ドキュメントに記載された Environment のインポートが解決されれば、issue は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。