Solved

Ionic/Angular/Cordova/Android - cannot find symbol

  • 7 December 2022
  • 3 replies
  • 235 views

Badge +4

Hello,

 

I am upgrading a pretty old project build on Ionic/Cordova/Angular with latest packages, and I am encourteing an issue on Android.

I upgraded my project to ionic 6 and Angular 14. I also upgraded all plugins with @awesome-cordova-plugins.

 

RevenueCat plugins are also updated.

package.json:

```

"@awesome-cordova-plugins/purchases": "^6.2.0",

"cordova-plugin-purchases": "^3.3.3",

```

 

Everything works fine on iOS.

 

I ran into an issue when I try to build for Android

 

I upgraded minSdk to 31, and installed JDK 11.

Ionic documentation says we must use JDK 8, but I can’t build anything too because it needs sdk >= 31.

 

config.xml:

```

    <preference name="android-minSdkVersion" value="22" />
    <preference name="android-targetSdkVersion" value="31" />
    <preference name="android-compileSdkVersion" value="31" />

```

 

terminal:

```

[cordova] /Users/user/Sites/project/ionic/platforms/android/app/src/main/java/cc/fovea/PurchasePlugin.java:386: error: cannot find symbol
[cordova]       if (p.getSku().equals(sku))
[cordova]            ^
[cordova]   symbol:   method getSku()
[cordova]   location: variable p of type Purchase
[cordova] /Users/user/Sites/project/ionic/platforms/android/app/src/main/java/cc/fovea/PurchasePlugin.java:554: error: cannot find symbol
[cordova]       params.setOldSku(oldSku, oldPurchaseToken);
[cordova]             ^
[cordova]   symbol:   method setOldSku(String,String)
[cordova]   location: variable params of type Builder
[cordova] /Users/user/Sites/project/ionic/platforms/android/app/src/main/java/cc/fovea/PurchasePlugin.java:587: error: cannot find symbol
[cordova]         params.setReplaceSkusProrationMode(BillingFlowParams.ProrationMode.IMMEDIATE_WITH_TIME_PRORATION);
[cordova]               ^
[cordova]   symbol:   method setReplaceSkusProrationMode(int)
[cordova]   location: variable params of type Builder
[cordova] /Users/user/Sites/project/ionic/platforms/android/app/src/main/java/cc/fovea/PurchasePlugin.java:589: error: cannot find symbol
[cordova]         params.setReplaceSkusProrationMode(BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_PRORATED_PRICE);
[cordova]               ^
[cordova]   symbol:   method setReplaceSkusProrationMode(int)
[cordova]   location: variable params of type Builder
[cordova] /Users/user/Sites/project/ionic/platforms/android/app/src/main/java/cc/fovea/PurchasePlugin.java:591: error: cannot find symbol
[cordova]         params.setReplaceSkusProrationMode(BillingFlowParams.ProrationMode.IMMEDIATE_WITHOUT_PRORATION);
[cordova]               ^
[cordova]   symbol:   method setReplaceSkusProrationMode(int)
[cordova]   location: variable params of type Builder
[cordova] /Users/user/Sites/project/ionic/platforms/android/app/src/main/java/cc/fovea/PurchasePlugin.java:593: error: cannot find symbol
[cordova]         params.setReplaceSkusProrationMode(BillingFlowParams.ProrationMode.DEFERRED);
[cordova]               ^
[cordova]   symbol:   method setReplaceSkusProrationMode(int)
[cordova]   location: variable params of type Builder
[cordova] /Users/user/Sites/project/ionic/platforms/android/app/src/main/java/cc/fovea/PurchasePlugin.java:629: error: cannot find symbol
[cordova]           + " Replace old SKU? " + (params.getOldSku() != null));
[cordova]                                           ^
[cordova]   symbol:   method getOldSku()
[cordova]   location: variable params of type BillingFlowParams
[cordova] Note: Some input files use or override a deprecated API.
[cordova] Note: Recompile with -Xlint:deprecation for details.
[cordova] Note: Some input files use unchecked or unsafe operations.
[cordova] Note: Recompile with -Xlint:unchecked for details.
[cordova] 7 errors
[cordova] 
[cordova] FAILURE: Build failed with an exception.

```

 

Any idea what is causing this problem?

icon

Best answer by twestrick 7 December 2022, 17:37

View original

3 replies

Badge +6

The errors have “fovea” in the path. Fovea is a different Cordova plugin for IAP - https://purchase.cordova.fovea.cc. The npm package for it is cordova-plugin-purchase. Did you install it by accident?

Badge +4

@twestrick You’re a beast! I totally forgot that I tried cordova-purchase before moving to revenuecat. It seems I did not remove everything!

 

Thank you 🥰

Badge +6

Awesome! Yeah, I tried Fovea out first as well. Had everything developed (in the app and the backend, not using the Fovea service) and was running into weird iOS issues. I decided to switch to RevenueCat for better support (an entire company vs. one person) and ultimately deciding not wanting to manage all the app store integration myself. Subscriptions are an integral part of our app to make money and they need to work :)

Reply