Search Unity

PurchaseActivity NotFound when compiled with Android SDK 26

Discussion in 'Unity IAP' started by damelin2, Aug 29, 2017.

  1. damelin2

    damelin2

    Joined:
    Jan 8, 2013
    Posts:
    16
    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: https://issuetracker.unity3d.com/is...fest-dot-xml-file-using-latest-26-dot-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!
     
    Last edited: Aug 29, 2017
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,203
    @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.
     
  3. damelin2

    damelin2

    Joined:
    Jan 8, 2013
    Posts:
    16
    We're using the Internal (Default) setting. Mono2x, Min API Level set to 19, Max API Level set to 25.
     
  4. nabsteri10ri

    nabsteri10ri

    Joined:
    Oct 1, 2016
    Posts:
    3
    I am getting the same error with Unity 2018.2.18f1, using gradle build.
     
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,915
  6. SyedUmair

    SyedUmair

    Joined:
    Sep 2, 2013
    Posts:
    38
    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+EventFunction`1[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+EventFunction`1[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,
     
  7. SyedUmair

    SyedUmair

    Joined:
    Sep 2, 2013
    Posts:
    38
    @damelin2 were you able to fix this bug?
     
  8. SyedUmair

    SyedUmair

    Joined:
    Sep 2, 2013
    Posts:
    38
    @JeffDUnity3D Any solution to that?


     
  9. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,203
    @SyedUmair

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

    SyedUmair

    Joined:
    Sep 2, 2013
    Posts:
    38
    Yes, I have AndroidManifest file in my project.
     
  11. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,915
  12. SyedUmair

    SyedUmair

    Joined:
    Sep 2, 2013
    Posts:
    38
    Yes, it works perfectly fine on my devices. As mentioned earlier too, it was reported by Unity Cloud Diagnostics, that too only once.