Unity Ads Integration for Android without using aar package

April 17, 2016

Reading time ~1 minute

If you want to integrate Unity Ads into your native android project but also don’t want to use android library for some reason, then you are in the right place to get some assist. I listed possible reasons of not using aar package in the following list.

  • Not using Gradle build system.
  • Using maven and facing issues while importing aar into your project.
  • Want to add unity ads as library project.

First of all, you need to download unity-ads android library project under unity-ads-sdk

Apply following steps to integrate unity ads library into your project.

1. After downloading unity-ads android library project, put unity-ads directory into libs folder in the root of your android project.

2. Cretae an empty “src” named folder in the root of your unity-ads directory.

3. Open local.properties file in unity-ads directory and,

  • tell the source code should ve compiled with java 1.7
  • Show your android sdk path in your local machine.
sdk.dir="C:\\..\\sdk"
renderscript.opt.level=O0
java.source=1.7
java.target=1.7

4. Open your project’s AndroidManifest.xml file and add “xmlns:tools=”http://schemas.android.com/tools” definition line under the “

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	  xmlns:tools="http://schemas.android.com/tools"
      package="..."
      android:versionCode="..."
      android:versionName="..."
      android:installLocation="auto">

5. Now you need to add unity ads activity into your applications manifest file, under the “" node as follows :

<application
	....
	>

	....
	....
	<activity
	    android:name="com.unity3d.ads.android.view.UnityAdsFullscreenActivity"
	    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
	    android:hardwareAccelerated="true"
	    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
	    tools:ignore="UnusedAttribute" 
		/>

</application>

Now, you should be able to create an apk including unity ads resources and compiled codes using your build system.

If you want to learn how to implement unity ads on android, you can check this example implementation.

I hope this post is helpful for everyone.

Depending on an aar library includes transitive dependencies in a maven project

Depending on an aar library includes transitive dependencies in a maven project Continue reading