Import mobileads without gradle - Aide - android

I've made a game with Aide and I'm trying to incorporate Admob, but I'm running into trouble.
I'm using Aide to make it, and it's gradle support is only partly there. There is no build.gradle for libgdx projects in Aide, so I can't add the libraries I need that way. You can add the play services to a normal android app in Aide, and I can initialize mobileads in a blank app no problem.
I tried to copy the com.google.android.gms.ads folder into my game libs, it will import com.google.android.gms.ads - but there's only .R and .manifest that it will import. From what I can tell, there should be a mobileads.class file in the folder, but it's not. A blank app can find it, but I can't with a file explorer, or with my libgdx game.
Is there a workaround for this? I can't be the only person who has ever made a game in Aide and tried to add ads to it... can someone link me to a download of the class files I need? Or a libgdx gradle file for Aide?
If anyone has any ideas, it'd be greatly appreciated.

Related

Being to foolish to correctly implement a module library into my project

I recently started developing my really first Android Project using Android Studio 3.1.2.
Therefore I implemented a module library into my app, by cloning it from github, imported it as module library and added a dependency via right-click on app > module settings, switch to dependency tab, hit the +, select imported_module.
Additionally I checked my build.gradle(Module:app), if the dependency has been added correctly, there this line appeared:
dependencies {
...
implementation project(':imported_module')
}
Also in the settings.gradle file it says:
include ':app', ':imported_module'
Now if I want to access features of imported_module any of them can't be resolved. I browsed the official and the common forums for hours to find the one step I obviously missed but wasn't smart enough to find the solution.
Synching the project with gradle files didn't cause any visible effects
What do I still have to do to be able to use all the fancy stuff fro imported_module inside my app? Do I have to import it in a certain way?
Or do I have to modify my AndroidManifest of my app somehow? Thanks in forward!
EDIT: could it be that my app and imported_module obviously have different package names? The Project File Tree says com.domain.example.my_app for the app and com.domain.example.imported_module for imported_module. Do I have to squeeze the one into the other?
It could have been much easier, if you had mentioned what exactly you want to access in main app. May be access specifier of the member in your imported_module is private.
I kinda worked around the whole thing, by just adding a remote dependency in my build.gradle file of a new project, pasted my java classes and my res into this new project, synched it and now it runs. Nevertheless thanks for thy help!
That should be really all. Be sure to sync your project with Gradle files (File - Sync Project with Gradle Files).

How to import "android.support.wearable.watchface" in Eclipse for Android Wear?

I'm doing my best to figure out how to develop apps in Eclipse for Android Wear (I really don't like Android Studio). I have made a couple of apps so far for Android Wear in Eclipse that work perfectly fine, but I'm running into a big problem when trying to create a Watch Face.
I can't import the following:
import android.support.v7.graphics.Palette;
import android.support.wearable.watchface.CanvasWatchFaceService;
import android.support.wearable.watchface.WatchFaceService;
import android.support.wearable.watchface.WatchFaceStyle;
I have added the wearable-1.0.0.aar as a library as discussed here. I have tried adding as an external jar the "android-support-v7-appcomapt.jar" file located at "...sdk\extras\android\support\v7\appcompat\libs", but still no luck.
I am using the "Watchface" example given by google. When using it in Android Studio it works perfectly fine. The exact error I'm getting is:
CanvasWatchFaceService cannot be resolved to a type
Also, in my project under Android Private Libraries I have "classes.jar" and "android-support-v4.jar".
Does anyone have a fix? I figure it has something to do with external libraries and/or a jar I've missed.
Managed to figure it out. For anyone else who comes across this thread, the answer lies in the wearable-1.0.0 library in that it does not contain CanvasWatchFaceService. After looking through some of the other wearable projects, I found that the later versions have it. Just go to ...sdk\extras\google\m2repository\com\google\android\support\wearable. I chose the wearable-1.4.0 version.
Also, I added the external jar "android-support-v7-palette.jar" from the Android tools folder.
Now everything works perfectly for me.

Importing and using a library in android studio

I am using android studio to import this project called https://github.com/Pixate/pixate-freestyle-android. However when I import it into android studio the folder under samples, freestyleshowcase doesnt seem to build. The other 2 samples buld correctly. There is a red circle around the java file with a J (error) but there is no error in the file itself. COuld someone please help me out?
You are obviously missing some libraries but it is going to be hard for anyone to tell you which since we do not know the libraries the project needs.You can try Build-->Rebuild Project or Build-->Clean Peoject if it still doesn't work, close and open Android Studio.
If that doesn't work also then you have to go the hard way of identifying the libraries need by the project samples you imported and see if you have them.
When in doubt, you can try the Library Dependency option (using Maven) as demonstrated here:
https://www.youtube.com/watch?v=6BUcx9gGQ3o
That way, you won't have to manually edit the build.gradle file.

Android - cannot use external library

I was asked to make a project work in Android and I am a complete noob in this aspect and, well... things are not working...
I have created a little code in Java which uses libraries - this code works perfectly. I am now trying to make this code work on Android but I have problems...
It seems I cannot use any element from the libraries I imported to my Android project. The project loads on the phone perfectly fine when no instance of the library is created, but when I make use of the library the app crashed and I get errors.
http://i.imgur.com/OILHQ.jpg
Here is what the project package looks like
http://i.imgur.com/HQEX9.jpg
The part with the arrow is what I think makes the program crashed. When I remove this line, everything works fine.
I checked online about problems with Android and external libraries but I could not understand everything... Could you help me pinpoint exactly what is wrong and how to solve this?
Thanks!
I got this issue when I first started android development.
Key to this is to the external library seems to require them being another android project itself, instead of java project. After creating this android project, right click on the "external project" and choose properties. Under Android Tab, there should be something to check to denote that it is a library instead of application. After doing this, the linking is quite similar to how we link normal java projects to external java library
If you are using eclipse, than just create a "libs" folder in project root and drop your external libraries there.
Alternatively you Right-click on the jar file > build path > add to build path

Android Google API Java Client com.google.api.client.auth.oauth2.draft10

I was trying to do a simple app using the Google Tasks API. Something simple it's turning into a nightmare. Maybe it's something simple, probably it is, but I can't figure it out.
The problem: I was following the example of TasksSample.java from Google but I can't compile even after importing the libraries and dependencies required. I'm using Google API Java Client version 1.5.0.
The problem it's when I access the GoogleAccessProtectedResource class. The import is:
import com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource;
I always, and I mean always, no matter what code I have get the following error:
09-26 03:14:38.372: ERROR/dalvikvm(18731): Could not find class 'com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource', referenced from method com.greven.test.google.tasks.GoogleTasksTake100Activity.
09-26 03:14:38.402: ERROR/AndroidRuntime(18731): FATAL EXCEPTION: main
09-26 03:14:38.402: ERROR/AndroidRuntime(18731): java.lang.NoClassDefFoundError: com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource
I really can't see where the problem is. I imported all the needed .jars... I guess
As you can see in this picture the class is obviously imported:
So what other options do I have to fix this? Use Maven? I'm clueless now. I never thought I would have a problem like this. Oh I also tested on different computers, other Google java api client (version 1.4) and same thing happened. Thanks in advance.
It seems as per your screenshot that your imported jar is imported in Eclipse, however for your Android application to work you need these jars to be dropped into a specific folder so that it is added to your APK and so the emulator and the Android devices find it.
It seems you should drop these jars in a folder named /libs at the root of your project. See this SO question: How can I use external JARs in an Android project?
The Article you are referring too uses the /assets folder but this might have changed a few Android versions ago.

Categories

Resources