On the MoPub Integration Instructions it says to go to Properties, Build Path and click on 'add jar' and then to Click Add Jars and add the mopub-volley-1.1.0.jar from your download location.
I may be misunderstanding this, but when I click on Add Jars, I can only select locations within projects that are situation within my Eclipse workspace. Is it supposed to say 'Add External Jars'?........ It doesn't show this, it specifically shows the 'Add Jars' button highlighted, as you can see:
Or am I supposed to create a libs folder in my mopub-sdk project that I've imported and manually copy them in, then do 'Add Jars' and select them from there......
The docs say to 'Right click on your project' when adding these, however, the mopub-sdk that I've imported needs this Jar, so why do I have to add it to my project's build path when the MoPub-SDK is a dependency of my project - shouldn't I add it to the MoPub-sdk build path?!!
It's really confusing. Anyone who's integrated MoPub using Eclipse? This is now my 4th straight day attempting to integrate this, so any help would be much appreciated.
Related
I'm trying to create an Android application in Eclipse (on Windows Vista), and I can't get it to find the android.support.v7 library stuff that I need. I think I'm setting things up correctly, and what I'm doing works on one computer but is not working at all on another, and I need help figuring out where things are going wrong.
In Eclipse, I followed the steps to create a new "Android Application Project", and selected API 11 as the minimum SDK, and went through all the other steps. (For "Create Project in Workspace", I unchecked it and asked for the files to be created in a location on a network drive, in case that matters.) This created another project, appcompat_v7, which I understand is how things work now. I built that project. But then when I tried to build my application, I couldn't get past The import android.support.v7 could not be resolved errors.
Here's the symptom that concerns me: I right-clicked on the application project and selected Properties -> Android. The bottom part, "Library", has "C:\users\me\workspace\appcompat_v7" in the left (Reference) column, and a question mark in the right (Project) column. [This is the workspace directory, not the network-drive directory where I'm keeping the files.] Also there's a red X next to the pathname. I tried selecting Add, which brought up a list including the appcompat_v7 project that got automatically added. I selected that, and it got added to the list with a green check mark. Then I selected the other one and Remove'd it. Now the list had just one appcompat_v7 project, with a green check mark, and the correct name in the right column, so everything looked OK. I clicked OK (also tried Apply then OK). But when I went to Properties -> Android again, now the red X was back and the project name was ? again. So it seems that something it was able to find just a few seconds ago could no longer be found (?). Rerunning Eclipse hasn't helped. The workspace\appcompat_v7 directory and its contents seem to show up normally in a dir command, although if there's something missing I wouldn't know what to look for.
Any suggestions about what to try, or what to check for?
EDIT: By experimenting, I've found more information. Apparently unchecking "Create Project in Workspace", and then selecting a network drive, is what causes the problem. If I start with a clean workspace, and uncheck "Create Project in Workspace" and select a directory on the C: drive, everything works fine. If I do the exact same thing but select a directory on a different drive, such as a network drive or USB flash drive, the problems show up.
After more research, I've concluded that this is a symptom of Android Issue 16472, in which things fail if you have a project on one drive and a library on another drive. The new mechanism, in which the ADT plugin creates appcompat_v7 automatically when you set up a new project, exacerbates the problem. If the workspace is on the C: drive but you want the project files to be on some other drive, by unchecking "Create project in workspace", the plugin will put the project files on your other drive but create appcompat_v7 on the C: drive, which automatically causes the problems reported for #16472.
It's probably best to set up the workspace on the same drive where you put the project files (but I haven't tested this; and in any case, having them on different drives hasn't caused a problem for me, for non-Android Java projects). However, I've found a way to work around this, by copying appcompat_v7 to the other drive:
Use the Android Application Project wizard to create a new application, and let it create your project and a new appcompat_v7 project on different drives.
Using Windows Explorer or some other method, copy the newly created appcompat_v7 from C: to someplace on the other drive.
In Eclipse, delete the appcompat_v7 project.
Import -> Android -> Existing Android Code into Workspace. Browse to the location where you've made a copy of appcompat_v7, select it, and do the import. I found that it called the new project android-support-v7-appcompat, but this is OK. I waited for "Building Workspace" to complete (if you're set up not to build projects automatically, you may have to use Build Project on the new project).
Right-click on your application project, "Properties", "Android". The "Library" section will probably have a path name (the path of appcompat_v7 on the C: drive) with a red X by it. Click on Add; a window with android-support-v7-appcompat should show up; click on that. It should be added to the library list with a green check mark. Now select the path name on the C: drive, and click Remove and then OK. I'd double-check by clicking on "Properties" again, to make sure the library shows up and still has a green check mark.
After you do this, if your workspace is set up to build automatically, this should build your application successfully. (Otherwise build it manually.)
If you later add another application to the same workspace, you don't need to repeat steps 2, 3, or 4. After the wizard creates your project and another new appcompat_v7 or appcompat_v7_2 or something, use Step 5 to add the android-support-v7-appcompat you've already imported and remove the old library reference, then delete the duplicate appcompat_v7 that it just created. (See also Remove v7 appcompat folder.)
Add the library to your application project:
In the Project Explorer, right-click your project and select Properties.
In the category panel on the left side of the dialog, select Android.
In the Library pane, click the Add button.
Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-appcompat.
In the properties window, click OK.
If you open Java Build Path dialog for the android-support-v7-appcompat project it should look like the one on the picture below.
I know this is a bit old but if anyone had the same issue I fixed like this:
From gradle leave just the last V7 (mine is compile 'com.android.support:appcompat-v7:23.1.1'
and I deleted compile 'com.android.support:appcompat-v7:22.2.0'
) after that go in your class and delete the import v7...after sync again and you will see that Android Studio will ask automatically you if you want import the new Dialog.
I hope this simple case will help someone.
I am trying to follow the steps of setting up a v7 support library as they are listed on the android development website.
Create a library project and ensure the required JAR files are included in the project's build path
I get stuck on step 5 where I am supposed to right click the JAR files and choose "Build Path". This option is missing. I have checked other questions related to this such as this one>>> Question
but none of the listed solutions seem to work for me. Either that or I do not see the options that the posters are referring to on the menus. Has anyone had this problem? Where did I go wrong?
I need this for an android project.
If you are doing in eclipse, then you can go to ProjectName -> Right click on it -> Goto Properties -> Goto Java Build Path -> Go to Library -> Choose Add Jars option if jar is in same project or choose Add External JARs if jar is outside the project folder.
If you have already copied the JAR file to libs/ directory of your project then choose the option of Add JARs and browse to the libs folder where you've copied the jar. Select it and press okay. It should get included in your project. Hope this helps else please comment.
I have following problem:
I try to use SupportMapFragment from com.google.android.gms.maps.SupportMapFragment which is part of Google Maps Android API v2.
My first approach was to add project to Eclipse from android-sdk\extras\google\google_play_services\libproject\google-play-services_lib location and set it as referenced project in Properties -> Project References menu of MyApp. I also added project to Java Build Path / Projects. Error indicators disappeared from Eclipse but when I tried to run my app I got NoClassDefFoundError exception.
So my second approach was to copy jar file from google-play-services_lib/libs to my project's libs directory. MyApp succesfully started but in LogCat I can see dead code ... something message so I guess that jar file has to be referenced in another way.
And now I am confused and tired..
Maybe someone more experienced in Android can tell me what should I do ?
The quick start guide that keyboardsurfer references will work if you need to get your project to build properly, but it leaves you with a dummy google-play-services project in your Eclipse workspace, and it doesn't properly link Eclipse to the Google Play Services Javadocs.
Here's what I did instead:
Install the Google Play Services SDK using the instructions in the Android Maps V2 Quick Start referenced above, or the instructions to Setup Google Play Services SDK, but do not follow the instructions to add Google Play Services into your project.
Right click on the project in the Package Explorer, select Properties to open the properties for your project.
(Only if you already followed the instructions in the quick start guide!) Remove the dependency on the google-play-services project:
Click on the Android category and remove the reference to the google-play-services project.
Click on the Java Build Path category, then the Projects tab and remove the reference to the google-play-services project.
Click on the Java Build Path category, then the Libraries tab.
Click Add External JARs... and select the google-play-services.jar file. This should be in [Your ADT directory]\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs.
Click on the arrow next to the new google-play-services.jar entry, and select the Javadoc Location item.
Click Edit... and select the folder containing the Google Play Services Javadocs. This should be in [Your ADT directory]\sdk\extras\google\google_play_services\docs\reference.
Still in the Java Build Path category, click on the Order and Export tab. Check the box next to the google-play-services.jar entry.
Click OK to save your project properties.
Your project should now have access to the Google Play Services library, and the Javadocs should display properly in Eclipse.
What i have done is that import a new project into eclipse workspace, and that path of that was be
android-sdk-macosx/extras/google/google_play_services/libproject/google-play-services_lib
and add as library in your project.. that it .. simple!!
you might require to add support library in your project.
Be Careful, Follow these steps and save your time
Right Click on your Project Explorer.
Select New-> Project -> Android Application Project from Existing Code
Browse upto this path only - "C:\Users**your path**\Local\Android\android-sdk\extras\google\google_play_services"
Be careful brose only upto - google_play_services and not upto google_play_services_lib
And this way you are able to import the google play service lib.
Let me know if you have any queries regarding the same.
Thanks
Some of the solutions described here did not work for me. Others did, however they produced warnings on runtime and javadoc was still not linked. After some experimenting, I managed to solve this. The steps are:
Install the Google Play Services as recommended on Android Developers.
Set up your project as recommended on Android Developers.
If you followed 1. and 2., you should see two projects in your workspace: your project and google-play-services_lib project. Copy the docs folder which contains the javadoc from <android-sdk>/extras/google/google_play_services/ to libs folder of your project.
Copy google-play-services.jar from <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/libs to 'libs' folder of your project.
In google-play-services_lib project, edit libs/google-play-services.jar.properties . The <path> in doc=<path> should point to the subfolder reference of the folder docs, which you created in step 3.
In Eclipse, do Project > Clean. Done, javadoc is now linked.
I followed some steps I found here (can't find the URL right now, sorry) to convert my Android project in Eclipse to a layout where 99.9% of my code is in a library project, and then I have 2 other shell projects under the same workspace that are mostly just the AndroidManifest.xml files, and a few resource files. This was done so I can support 2 builds of the same project, with just some minor text/icon changes between the 2. The application name is also different so I can publish both on the Android Market at the same time.
Ever since I did this, about every 10 times I compile, maybe once every day or two, I get "dalvik error 1" and something about "Access already exists" (Access being the name of the first Java unit in my library project).
To "work around" the issue I go in to the Java Build path for my stub-project that I am trying to build, and remove the JAR file from my main library from the libraries tab. Then I can build without the error.
Then a while later (maybe 1 or 2 days) I'll get an error about missing classes when I compile my stub-project (not my library). So I'll go back to the Java Build path and put the reference to the JAR file back in, and all is good again for 1 or 2 days, then I'm back to the same error as before.
Is this just a known issue and something I need to do, or can I resolve by a restructure of my projects/workspaces? Currently I have:
Lib Project - only has 2 libs on build path: Android 2.1 and com.android.ide.eclipse.adt.LIBRARIES
First stub project that uses above lib - has the same 2 libs as above project, plus sometimes I use "Add JAR" to include the JAR from the above project's bin\ folder.
2nd stub project - same libs as first stub project
Should I reference the JAR from my "lib project" using one of the other tabs under build path options? Maybe the "Project" tab instead, or the "Source" tab? I don't currently have it under any of those other areas.
When I get in to the weird state, doing a "Clean project" also doesn't help, I've tried that several times and open/close the IDE between cleaning, to no resolve.
At this point we are in the final testing stages, so my normal daily task is:
Make a minor update (bug fix) in the LIB project
Use the publish wizard to export both projects and update Android Market and other places we keep the APK files
So I'd like those steps to stay simple, without having to open/close multiple workspaces or go through a lot of build steps if possible.
The classical Eclipse/Java way
Add a (workspace) library
Right click the project you want to insert in.
Click Properties.
Select Java Build Path.
Select the Libraries tab.
Now, it depends how you compile your library.
So either do an Add JARs... or an Add Class Folder.
Choose the external variant to use an external source.
That's it.
Add a workspace project
Right click the project you want to insert in.
Click Properties.
Select Java Build Path.
Select the Projects tab.
Click Add... on the right side and you are done.
The additional Android way
Two steps are necessary:
Mark the project you want to use as library project
Reference the marked project
Mark the library project
Right click your project and select Properties.
Select Android on the left and tick the checkbox IsLibrary. Done.
Reference the marked project
Right click your project and select Properties.
Select Android on the left and Add... your marked project. It will be added to the list and is ready to use. Now you are able to access all classes and ressources (e.g. drawables, strings) from the referenced, marked project. Awesome, eh? :)
I was reading one of the articles on internet and he was saying that he'll make library so that all the apps can use it. How is this possible? Any ideas?
To add libraries to your project, in eclipse package manager right click on your project select 'Properties' on the left select 'Java Build Path' then click on the libraries tab toward the top. Click the 'Add External Jars' button navigate to the jarfile and select it. Then you are ready to import and use whatever was inside of it in your project. I recommend you add a libs folder to your project and keep all of the jar files used in that project inside there so that if you distribute your project source to someone else they will have all of the needed libraries to compile it.