5

I was trying to follow this post to import the mopub SDK into my app, however Android Studio is being difficult.

I unzipped the SDK, and went to Project Structure to select import a New Module. When I chose the unzipped folder, the Finish button is grayed out, and there is an error saying 'Select Modules to import'

I am using Android Studio version 0.8.6. Here is a screenshot of the error menu

Community
  • 1
  • 1
Dtroll MC
  • 303
  • 5
  • 14

3 Answers3

9

I had the same issue so I had to install it manually.

First, unzip the downloaded file and then copy the unzipped mopub-sdk folder into your project directory.

Next, open your project's settings.gradle file and make sure the MoPub SDK is included as a module:

include ':app', ':mopub-sdk'

Open your app's build.gradle file (not your main project one) and add the MoPub SDK as a dependency:

dependencies {
    compile project(':mopub-sdk')
}

These instructions are based of those found on the mopub github.

Joel
  • 14,861
  • 3
  • 27
  • 31
  • Copy it to my project's root directory, or does it need to be in a specific folder? I will try it in the root. Thanks for the answer, I will respond if it works. – Dtroll MC Nov 05 '14 at 20:12
  • Update: I tried this and then tried to add a banner advertisment, and I get an error saying "The following classes could not be found: -com.mopub.mobileads.MoPubView" I tried building the project to no avail. The mopub sdk is in the root folder. – Dtroll MC Nov 05 '14 at 20:20
  • What steps did you try to add a banner advertisement? Did you follow this [guide](https://github.com/mopub/mopub-android-sdk/wiki/Banner-Integration)? Does any other aspect of the sdk work? – Joel Nov 06 '14 at 08:47
  • I did not follow that guide, I just tried to directly add the objkect in XML. I followed that guide, but at step 1 when I tried to add the activities, Android Studio could not 'Resolve symbol mopub' – Dtroll MC Nov 06 '14 at 11:57
  • It seems like the library isn't recognized, which is weird because the steps I mentioned has it working for me on AS 0.8.14. The only other thing I can think of is trying File > Invalidate and Restart Caches – Joel Nov 06 '14 at 14:24
  • So I did this, and it fixes the errors you mentioned, now however, Android Studio can't resolve the symbol millenialmedia in the MillenialInterstitial and MillentialBanner – Dtroll MC Nov 07 '14 at 12:14
  • Also, "Error:(7, 35) error: package com.millennialmedia.android does not exist" – Dtroll MC Nov 07 '14 at 12:16
  • Assuming you have downloaded the `MoPub Android Full SDK.zip` file then you can find instructions how to integrate it [here](https://github.com/mopub/mopub-android-sdk/wiki/Integrating-Third-Party-Ad-Networks). Any other questions you have about this I would perhaps open a new question for. – Joel Nov 07 '14 at 13:55
4

In eclipse, if we create a project which is having library projects inside our project, then

enter image description here

we cannot import this project as module in Android studio. This may be the issue

enter image description here

Vyshnavi
  • 338
  • 3
  • 9
1

It's not fault of AndroidStudio, just try archived sdk, it works

https://github.com/mopub/mopub-android-sdk/archive/v3.9.0.zip

from https://github.com/mopub/mopub-android-sdk/releases

// sorry I don't enough reputation to post image

Cuong Nguyen
  • 1,166
  • 1
  • 11
  • 20