Hello there,
I hope that anyone here can help my. I have a problem to import Applovin in my Unity Projekt.
I use Unity Version 5.3.1f1 32 Bit.
I have an empty Android Projekt and integrated the Google Play Services SDK in my Game and this just works fine. Now I want to integrate the Applovin plugin as described here: https://www.applovin.com/integration#unity3dIntegration
I imported the newest Applovin Plugin “AppLovin-Unity-Plugin-3.3.0” into my project and I did all the steps that are descriped in the linked AppLovin page and also set up the AndroidManifest withe the Applovin SDK-Key and my Package name. I can run my project in the Unity Editor and I can also Build my project, but if I trie to Build an Run the Game (and unity tries to install the game on my phone) I get these Errors:
Error 1:
Installation failed with the following output:
pkg: /data/local/tmp/Package.apk
Failure [INSTALL_FAILED_OLDER_SDK]
2808 KB/s (23380215 bytes in 8.128s)
UnityEditor.HostView:OnGUI()
Error 2:
UnityException: Unable to install APK!
Installation failed. See the Console for details.
UnityEditor.Android.PostProcessAndroidPlayer.ShowErrDlgAndThrow (System.String title, System.String message, System.Exception ex)
UnityEditor.Android.PostProcessAndroidPlayer.ShowErrDlgAndThrow (System.String title, System.String message)
UnityEditor.Android.PostProcessAndroidPlayer.UploadAndStartPlayer (System.String manifestName, System.String stagingArea, UnityEditor.Android.AndroidDevice device, System.String packageName, Boolean developmentPlayer, Boolean retryUpload)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
UnityEditor.HostView:OnGUI()
I tried also to build the apk then transfer it on me phone via USB cable and then install it directly from my phone. Here I got an “Parsing-Error” on my phone. Meaning that it is unable to read the package.
These errors do not appear until the import of the AppLovin Package…
At the AppLovin Page I found the following statement regarding Unity 5:
https://support.applovin.com/support/solutions/articles/1000172436-do-you-support-unity-5-
But I don’t know if this statement is still relevant and I don’t find these settings (" Simply go to “Build Phases” in your project settings and add the “-fno-objc-arc” flags to the following files under the Compile Sources section:")
I hope anyone can help me…
Here is my Code for the Applovin plugin and the AndroidManifest (sorry for the bad formatting) :
using UnityEngine;
using System.Collections;
publicclassAdsController:MonoBehaviour{
publicstaticAdsControllerinstance;
privateconststringSDK_KEY=“f24gdrSdT2glk-Gx7wg_-nTkT3wew27Z5BFi1iLUl1DT0UO7P47Nrf5Jk0zd34B9FRtH9DmuEzLFSlMsqTEf8K”;
voidAwake()
{
MakeSingleton();
}
voidMakeSingleton()
{
if(instance !=null)
{
Destroy(gameObject);
}
else
{
instance=this;
DontDestroyOnLoad(gameObject);
}
}
voidStart()
{
AppLovin.SetSdkKey(SDK_KEY);
AppLovin.InitializeSdk();//Diesmussinderstartstehen,daesdannwährenddergesamtenLaufzeitnureinmalausgeführtwird!
AppLovin.SetUnityAdListener(this.gameObject.name);
StartCoroutine(CallAds());
}
voidOnLevelWasLoaded()
{
if(Application.loadedLevelName==“MainMenu”)
{
intrandom=Random.Range(0,10);
if(random>5)
{
ShowInsterstitial();
}
else
{
ShowVideo();
}
}
}
IEnumeratorCallAds()
{
yieldreturnStartCoroutine(MyCoroutine.WaitForRealSeconds(3f));
LoadInsterstitial();
LoadVideo();
AppLovin.ShowAd(AppLovin.AD_POSITION_TOP,AppLovin.AD_POSITION_CENTER);
}
//Lädeine Anzeige
publicvoidLoadInsterstitial()
{
AppLovin.PreloadInterstitial();
}
publicvoidShowInsterstitial()
{
if(AppLovin.HasPreloadedInterstitial())//Anzeigeschongeladen?
{
AppLovin.ShowInterstitial();
}
else
{
LoadInsterstitial();
}
}
publicvoidLoadVideo()
{
AppLovin.LoadRewardedInterstitial();
}
publicvoidShowVideo()
{
AppLovin.ShowRewardedInterstitial();
}
voidonAppLovinEventReceived(stringev){
if(ev.Contains(“DISPLAYEDINTER”)){
//Anadwasshown.Pausethegame.
}
elseif(ev.Contains(“HIDDENINTER”)){
//Adadwasclosed.Resumethegame.
//Ifyou’reusingPreloadInterstitial/HasPreloadedInterstitial,makeapreloadcallhere.
AppLovin.PreloadInterstitial();
}
elseif(ev.Contains(“LOADEDINTER”)){
//Aninterstitialadwassuccessfullyloaded.
}
elseif(string.Equals(ev,“LOADINTERFAILED”)){
//Aninterstitialadfailedtoload.
LoadInsterstitial();
}
elseif(ev.Contains(“LOADEDREWARDED”)){
//Arewardedvideowassuccessfullyloaded.
}
elseif(ev.Contains(“LOADREWARDEDFAILED”)){
//Arewardedvideofailedtoload.
LoadVideo();
}
elseif(ev.Contains(“HIDDENREWARDED”)){
//Arewardedvideowasclosed.Preloadthenextrewardedvideo.
LoadVideo();
}
}
}
Android Manifest:
<?xmlversion="1.0"encoding="utf-8"?><manifestxmlns:android=“http://schemas.android.com/apk/res/android”
package=“com.AppLovinTest”
android:installLocation=“preferExternal”
android:versionCode=“1”
android:versionName=“1.0”>
activityandroid:name=“com.applovin.adview.AppLovinInterstitialActivity”/
activityandroid:name=“com.applovin.adview.AppLovinConfirmationActivity”/
actionandroid:name=“android.intent.action.MAIN”/
categoryandroid:name=“android.intent.category.LAUNCHER”/
uses-permissionandroid:name=“android.permission.INTERNET”/
<uses-permissionandroid:name="android.permission.READ_EXTERNAL_STORAGE"android:maxSdkVersion =“22”/>
<uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"android:maxSdkVersion =“22”/>
uses-permissionandroid:name=“android.permission.ACCESS_NETWORK_STATE”/