MoPub import problem, I know that I just miss something stupid

So, I decided to split my project (for Lite / full version control) today. I put together the main code in the library project, added two new shell projects, and linked them together. All this worked fine, and I can run either the lite or the full version without any problems.

However, I had a problem integrating Mopub into the library project. I followed their little tutorial, which is very simple. My problem is the build order of packages inside the project. As part of the installation process (shown here ), it creates the com.mopub.mobileads package in my project.

This is the first time I have had a problem with multiple packages in a project, but for some reason Eclispe insists that my import:

 import com.mopub.mobileads.MoPubView; 

part of com.mopub in particular cannot be resolved.

My only assumption is that when I compile, it first tries to compile my package, and it just does not see the Mopub package. However, if this is so, I can’t understand for life how to change the assembly order of individual packages. If I wanted to change the order of the projects, I would be installed, as it was simple. Google also did not really help me with this.

I know that I can just add the source files to my own package, fix their import so that it matches, and the problem has been resolved, but what an ugly hack I would prefer to avoid.

I know that I'm just missing something stupid, but I just don't see it.

The errors it gives indicate an import line and every line that refers to MoPubView, what exactly do you expect:

 (error x 5)MoPubView cannot be resolved to a type mainAct.java R.id.adView cannot be resolved mainAct.java The import com.mopub cannot be resolved mainAct.java 
+6
source share
2 answers

You can try to change the way Eclipse responds to path creation problems.

Access project properties (right-click project => Properties or Command + I on Mac) and select Java Compiler => Building in the left pane. In the right pane, Enable project specific settings and change the settings in the Build path properties section.

Assuming that you actually do not have circular dependencies that need to be fixed, this should be enough.

+1
source

I had a similar problem when integrating the SDK with a project I'm working on in Android Studio (v0.8.9).

During import, I was unable to get com.mopub.mobileads.MoPubView for permission. It turns out that when Mopub was imported as a module, two problems arose:

  • MMSDK was not added as a module dependency.
  • mopub / src / main / java was not added as the source folder ... only in the gen folder.

After adding the dependent and additional source folders, the implementation worked flawlessly. Hope this helps someone else in the future.

0
source

Source: https://habr.com/ru/post/890044/


All Articles