Cannot compile Android apk in Unity

Comments

4 comments

  • Avatar
    Alexander Belyaev

    Hello !

    Could you please try manually copying Assets/Editor, Assets/Plugins, Assets/Pushwoosh folders from the Sample Project into yours ?

    Please do not forget to merge contents of Assets/Plugins/Android/PushwooshAndroidManifest.xml into Assets/Plugins/Android/AndroidManifest.xml

    Please follow the link below to get the AndroidManifest sample.

    https://github.com/Pushwoosh/pushwoosh-unity/blob/master/PushwooshUnitySample/Assets/Plugins/Android/AndroidManifest.xml

    I tried deleting the following files (that came with the PushWoosh Unity pacakge) from the Unity Assets/Android/Plugins directory: android-support-v4.jar play-services-base-9.6.1.aar play-services-basement-9.6.1.aar play-services-gcm-9.6.1.aar play-services-iid-9.6.1.aar play-services-location-9.6.1.aar

    Unity manages to compile an apk project but then I don't get any push notification in my app, so I think these files are required.

    These libraries are essential for push notification functionality, so you should not remove it from your project, otherwise your device will not be able neither to register for pushes nor to receive it.

  • Avatar
    olivierbizarre

    Thanks - I re-did the integration exactly per your instructions, but am still having the same problem trying to build an Android build in Unity. (It's working fine for iOS BTW - I can build an iOS build and receive push notifications). I have also integrated the Chartboost SDK - which is working fine.

    Here are the errors I am getting when trying to generate an apk in Unity:

    CommandInvokationFailure: Failed to re-package resources. /Users/admin/Library/Android/sdk/build-tools/23.0.3/aapt package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Users/admin/Library/Android/sdk/platforms/android-23/android.jar" -F bin/resources.ap_ --extra-packages com.unity.purchasing.amazon:com.chartboost.sdk.unity:com.android.vending.billing:com.unity.purchasing.googleplay:com.pushwoosh:com.pushwoosh.unityplugin.badges:com.pushwoosh.unityplugin:com.unity.purchasing:com.google.android.gms.base:com.google.android.gms:com.google.android.gms:com.google.android.gms.gcm:com.google.android.gms.iid:com.google.android.gms.location:com.unity3d.ads.android -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/AmazonAppStore/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/GoogleAIDL/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/GooglePlay/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/Pushwoosh/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/PushwooshBadges/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/PushwooshUnityPlugin/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/common/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/play-services-base-9.6.1/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/play-services-basement-9.0.0/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/play-services-basement-9.6.1/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/play-services-gcm-9.6.1/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/play-services-iid-9.6.1/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/play-services-location-9.6.1/res" -S "/Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res"

    stderr[ /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_audio_toggle.xml:2: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from <relativelayout> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_audio_toggle.xml:61: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <textview> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_audio_toggle.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentStart from <relativelayout> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_audio_toggle.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <relativelayout> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_audio_toggle.xml:52: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <view> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_audio_toggle.xml:44: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <view> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_audio_toggle.xml:19: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentStart from <view> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_audio_toggle.xml:10: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <view> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_audio_toggle.xml: note: using v17 attributes; synthesizing resource com.pixelbizarre.CrashyCars:layout/unityads_button_audio_toggle for configuration v17. /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_pause.xml:8: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <view> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_button_pause.xml: note: using v17 attributes; synthesizing resource com.pixelbizarre.CrashyCars:layout/unityads_button_pause for configuration v17. /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_view_video_play.xml:92: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentStart from <include> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_view_video_play.xml:57: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentEnd from <linearlayout> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_view_video_play.xml:57: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from <linearlayout> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_view_video_play.xml:44: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from <textview> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_view_video_play.xml:29: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <textview> /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/unityads-release/res/layout/unityads_view_video_play.xml: note: using v17 attributes; synthesizing resource com.pixelbizarre.CrashyCars:layout/unityads_view_video_play for configuration v17. /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/play-services-basement-9.0.0/res/values/values.xml:3: error: Attribute "imageAspectRatioAdjust" has already been defined

    /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/play-services-basement-9.0.0/res/values/values.xml:3: error: Attribute "imageAspectRatio" has already been defined

    /Users/admin/Dropbox/mycompany/Unity/MyGame/Temp/StagingArea/android-libraries/play-services-basement-9.0.0/res/values/values.xml:3: error: Attribute "circleCrop" has already been defined

    ]

    In Android Studio I see this errors Error:(8, -1) android-apt-compiler: [PushwooshUnityPlugin] /Users/admin/Dropbox/mycompany/Unity/Android_build/AndroidStudiobuildDec27/PushwooshUnityPlugin/AndroidManifest.xml:8: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').

    It seems that the AndroidManifest.xml inside PushwooshUnityPlugin.aar is conflicting with other manifests?

  • Avatar
    Alexander Belyaev

    Hello,

    This is quite strange. It seems that your issue requires a deeper investigation, so may I ask you to contact our support team applying the following form:

    https://www.pushwoosh.com/contact-us

    Please also attach your AndroidManifest.xml so we could assist you better.

    Regards, Alex.

  • Avatar
    olivierbizarre

    Well, I ended up creating a new project from scratch and got the PushWoosh SDK notification to work on Android :-) As soon as I added the Chartboost SDK to my project I got into the nightmare of Unity errors: "CommandInvokationFailure: Failed to re-package resources." It seems the 2 SDKs have library incompatibilities. I ended up deleting the asset Android/Plugins/play-services-basement-9.0.0.aar that Chartboost added to my Unity assets and it seems to work now. Only remaining problem is that my app icon appears twice on an Android device - I will look into my manifest again...

Please sign in to leave a comment.