PurchaseActivity NotFound when compiled with Android SDK 26

Hi,

We have found that when compiling with Android SDK 26 we must now declare the PurchaseActivity in our Android Manifest. It’s working fine with Android SDK 25, the activity is automatically added by Unity.

We have tried with Unity 5.6.1f1 and 5.6.3f1

Adding the activity to the manifest fix the issue, but I was wondering if there more documentation about this?

According to this thread: Unity Issue Tracker - [Android] READ_PHONE_STATE permission is added in the AndroidManifest.xml file using latest (26.0.2) SDK
The Manifest Merger is now more strict under SDK 26. It this related?

The exact error I had with SDK 26:
AndroidJavaException: android.content.ActivityNotFoundException: Unable to find explicit activity class {ca.roofdog.pm3/com.unity.purchasing.googleplay.PurchaseActivity}; have you declared this activity in your AndroidManifest.xml?

Thanks!

@damelin2

Thanks for the report. You are correct that this should be included automatically.

Would you be able to provide a bit more detail about this issue?

  • What are your building settings? Are you using gradle?

We will investigate this further and let you know what we find.

We’re using the Internal (Default) setting. Mono2x, Min API Level set to 19, Max API Level set to 25.

I am getting the same error with Unity 2018.2.18f1, using gradle build.

Please provide specific steps to reproduce on a new project. Preferably with the IAP Sample project here https://discussions.unity.com/t/700293

I also get the same error (reported by Unity Diagnostics → Crashes and Exceptions) on device Android OS 9 / API-28 (PPR1.180610.011/J).

My environment is:
Unity Version: 2019.1.11f1
Backend: IL2CPP with Gradle system
Min API Level: Android 4.1 (JellyBean) / API-16
Device (issue occured on): samsung/SM-J415G/j4primelte
OS Version: Android OS 9 / API-28

Let me know if any further info is required.
PS. Build is compiled using Unity Cloud Build.

STACK TRACE is:

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.tictales.fictions/com.unity.purchasing.googleplay.PurchaseActivity}; have you declared this activity in your AndroidManifest.xml?
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2020)
android.app.Instrumentation.execStartActivity(Instrumentation.java:1677)
android.app.Activity.startActivityForResult(Activity.java:4696)
android.app.Activity.startActivityForResult(Activity.java:4654)
android.app.Activity.startActivity(Activity.java:5015)
android.app.Activity.startActivity(Activity.java:4983)
com.unity.purchasing.googleplay.ActivityLauncher.startActivity(ActivityLauncher.java:19)
com.unity.purchasing.googleplay.GooglePlayPurchasing.Purchase(GooglePlayPurchasing.java:802)
com.unity.purchasing.common.StoreDeserializer.Purchase(StoreDeserializer.java:17)
com.unity3d.player.UnityPlayer.nativeRender(Native Method)
com.unity3d.player.UnityPlayer.c(Unknown Source:0)
com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:88)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:214)
com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
UnityEngine.AndroidJNISafe.CheckException () (at <00000000000000000000000000000000>:0)
UnityEngine.AndroidJavaObject._Call (System.String methodName, System.Object[ ] args) (at <00000000000000000000000000000000>:0)
UnityEngine.Purchasing.GooglePlayAndroidJavaStore.Purchase (System.String productJSON, System.String developerPayload) (at <00000000000000000000000000000000>:0)
UnityEngine.Purchasing.JSONStore.Purchase (UnityEngine.Purchasing.ProductDefinition product, System.String developerPayload) (at <00000000000000000000000000000000>:0)
UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.Product product, System.String developerPayload) (at <00000000000000000000000000000000>:0)
UnityEngine.Events.UnityAction.Invoke () (at <00000000000000000000000000000000>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1].Invoke (T1 handler, UnityEngine.EventSystems.BaseEventData eventData) (at <00000000000000000000000000000000>:0) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1] functor) (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, System.Boolean pressed, System.Boolean released) (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchEvents () (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.StandaloneInputModule.Process () (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.StandaloneInputModule:Process()

Thanks,

@damelin2 were you able to fix this bug?

@JeffDUnity3D Any solution to that?

@SyedUmair

Does your project have an AndroidManifest file? Or are you simply using the one that is automatically generated by Unity?

Yes, I have AndroidManifest file in my project.

Are you able to provide the device logs? https://discussions.unity.com/t/699654 Does it work as expected when you do a local build?

Yes, it works perfectly fine on my devices. As mentioned earlier too, it was reported by Unity Cloud Diagnostics, that too only once.