How to give reference to Platform SDK from Groovy IntelliJ project? - groovy

I am new to Groovy and InteliJ. I need to create a project with Groovy script. It is dependent on Axeda platform SDK from here
Using intellij, I have created a New project - Groovy Module. Used project SDK as Java JDK 1.7
I need to import some classes from Axeda SDK now. How can I give the reference to this SDK now?

You will need to add the relevant .jar files from the SDK as module dependencies.
Assuming you will need more than one .jar file and may need to reuse it for other project, you might want to create a global library for the SDK as described here. Then you can use this library for any project which needs the SDK.

Related

Importing LIBGDX library gdx-backend-android.jar into Android Studio Project

After a hiatus of a couple of years I'm picking up Android development again.
I installed the newest Android Studio(4.1.1) with the latest Android SDK version (Android 11, API 30). After that I created a new project with gdx-setup.
If I add the old java source to my newly generated project I get this error:
error: package com.badlogic.gdx.backends.android does not exist
I'm not sure how to add this jar into the new project. In the Gradle configuration I see mentions of the backend, but it's not available.
I also downloaded the 'gdx-backend-android.jar' from the nightly build and put the jar in the Android library folder, all to no avail.
Does anyone actually know how to correctly add this dependency into my project?
I added the jar but still have an error, don't mind the other errors, I first need to fix the GDX import.
The project dependencies are managed by Gradle, so there is no need for you to directly touch any .jar files at all.
The most likely issue you're facing is that you are trying to use Android-specific classes from the core module, which is platform agnostic.
In a typical libGDX project, you do almost all your game code in the core module so it can easily be compiled for any platform. The code you showed above would be in the android module, but your LiveWallpaperStarter class would be part of core.
Some might say there's no reason to use core at all if you're making a Live Wallpaper, since it can't run on any other platforms besides Android. But there is some advantage in keeping the rendering in core so you can test in a desktop game window, because you can more rapidly compile and run on the desktop. This library has some tools that make it easy to wrap your rendering code in a class that lets you simulate a live wallpaper on desktop, for testing.

How to use releaseImplementation in a library

I am using Android Studio 3.0 with the updated gradle plugin.
I need to use the releaseImplementation keyword in my build.gradle file as I only want the library specified (ACRA) to be built in release. The reason I only want to build ACRA in release is that I've read that Android Studio instant run does not work well with ACRA.
releaseImplementation 'ch.acra:acra:4.9.2'
The problem is, however, that it's a library so I also need to use the api key so I can transitively export in apis to the modules using the library.
api 'ch.acra:acra:4.9.2'
Is it possible to use both keywords or is there a composite keyword to use?
releaseImplementation 'ch.acra:acra:4.9.2'
api 'ch.acra:acra:4.9.2'
In Android Studio 3.0 and newer, the Android Gradle Plugin supports the new Java Library plugin configurations that allow more granular control of dependencies.
As described here, the new Gradle Dependency configurations are available for flavor- or build-type-specific dependencies.
If you wish to use the api dependency configuration for the release build Type, you would add the following:
releaseApi 'ch.acra:acra:4.9.2'
This is the "composite keyword" that you are describing. No additional dependency needs to be specified.

Navigating full Android source code

How can I create and Android project that links to complete android source code, including classes in "android.annotation" ?
More precisely:
Create a new android project in Android Studio 1.5.1, Minimum SDK = API 23. Template: Add no activity.
Add this fix to resolve junit dependency: https://stackoverflow.com/a/32566057/4182868
gradle sync, make project
open class android.app.Activity
Result: a number of import statements are not resolved:
That's because those classes are actually marked as #hide, and are stripped out of the Android SDK at build time. The SDK android.jar that your project is linked with simply doesn't contain those methods and classes, which is why the IDE gets confused when it looks up the source code for the SDK classes.
(Note: We include the same annotations in the support library, but with a different package prefix: android.support.annotation.*. Those are the annotations applications should be using. But the framework itself doesn't depend on the support library, the dependency is in the other direction.)

How do I build a library into a .jar with Android Studio 1.1?

In the docs, it says:
Note: You need SDK Tools r14 or newer to use the new library module
feature that generates each library module into its own JAR file.
I have the latest SDK Tools, so I should be able to do this. But when I build my library (the compile completes without errors) I can't find any .jar file.
I set up the module in question as an "Android Library" with no Activity. It's using gradle build scripts. I'm building this to be a plugin for a Unity3d project, so it needs to be a .jar built with JDK 1.6.
The trick is that something must depend on the library for it to be built into a jar file.
So making an empty application module that depends on the library made it generate the jar. It is found in
app\build\intermediates\exploded-aar\ProjectName\LibraryName\

Unable to use #Entity ,#Id annotations in android studio

I am a newbie in using google loud endpoints in m android app.
I followed several tutorials on developing a GAE back-end for my android app in android studio.
I made an android app and then auto-generated back-end for it.
In back-end module I created a bean and auto-generated end point class for it. But when I try to add annotations like #Entity,#Id etc then they are not recogniZed.
I have added objectify-4.0b1 jar to WEB-INF/lib in api project.
What am I missing?
Please advise.
Manish
The IDE needs to know about the objectify library. Did you use the Google Cloud Module generation built into Android Studio to create your endpoint? If so you should have your backend configured through Gradle. This would give you two options:
option 1) is add the following line to your dependencies clause in your backend build.gradle:
compile 'com.googlecode.objectify:objectify:4.0b1'
Although the latest version is 5.1.4 so if you can you should just use that.
option 2) is to go to file -> project structure, then select your backend module and add a library dependency. That will popup a search dialog where you can search for the objectify dependency and automatically add it to your module. This will update your build.gradle for you.

Resources