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

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

Ouverte
#257 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
276
Forks
63
Merge moyen
4 h 35 min
PR mergées (30 j)
10

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par reproduire l’échec de l’importation avec la dépendance app-store-server-library-java en version 5.1.1, en utilisant la configuration pom.xml ou build.gradle décrite. Inspectez l’entrée du JAR com/apple/itunes/storekit/model/Environment.class et comparez-la avec le package utilisé par les imports Java ; l’issue est terminée lorsque l’import Environment documenté est résolu lors d’un build Maven ou Gradle propre.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
api
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
52/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.