I was fallowing a guide of creating a new java project in IntellIJ IDEA and in the end I got empty folder src without any files or sub-folders in it. Does anybody know what did I do wrong?
I work on this plugin. This is unfortunately all that is available for now using the App Engine flexible new project wizard. I would suggest instead to start from publicly available AE flex github project (such as the one referenced in this guide). You could also start with any Java 8 project as well since you are running on flex - you can then use the plugin to add App Engine flexible support to it:
Tools > Google Cloud Tools > Add App Engine support > Google App Engine Flexible
This will generate a template app.yaml for you and also expose the App Engine plugin features (like deploying to GCP).
There is nothing wrong with the project that you created. Since you were creating a new project, your project has an empty src folder with a .iml file. As eshaul commented, if you selected Create app.yaml box in the wizard, then the project will contain a template app.yaml under src/main/appengine.
Regarding this image, the files in the project helloworld are imported from Cloud Repositories. The procedure to import an existing project in Cloud Source Repositories is explained in the same tutorial that you was following (Checking out an existing project).
Related
I am trying to setup a project in Android Studio which includes several source files from an Eclipse project.
The Eclipse project has the following structure:
Library Project
It has a reference to several folders with java classes in them (included by link source)
Now I'd like to have these resources in my project/module in Android Studio too, but I can't find any possibility to achieve this other than copying them directly.
I'd like to avoid this because these files are part of a self written Java framework which is used in combination with GWT too. So copying these files instead of linking them means all changes have to be done twice.
Is it possible to include these sources similar to link source from Eclipse or is there another solution?
You could build your Eclipse project and reference it as a library in Android studio project. Then you would be able to access/use the required classes in the Android studio project.
Would somebody be able to explain why I am unable to create a new Java project in Intellij using both the Maven Plugin and the Google App Engine Plugin? I had previously created a Google App Engine project in Intellij and it was very easy to build and deploy my app using the App Engine plugin. Now I'm building my second app, and I would like to incorporate Maven as well but they seem to be mutually exclusive. I have seen that there are Maven archetypes for Google App Engine, but I am unsure of how to import those archetypes, or what their purpose is.
Thank you konqi. I ended up using a very similar strategy to what you suggested. I used the first 9 steps from this Google App Engine Tutorial to build a maven project from an appengine archetype in terminal. Then I opened intellij and imported the project (using all default values) and intellij automatically detected the appengine dependency.
I am very new to JAVA/ Android world. I come from C background. The AndroidStudio / Gradle stuff is a bit overwhelming for me.
I am looking to create a library using AndroidStudio. But when I click on "Start a new Android Studio Project" it asks me for Application name and then for activity et al. This is where it gets confusing for me. Why would these details be required to create a library module? Am I missing something here?
I know that there is a File - > New Module Menu and all that stuff, but that comes later once I have set the applicaton details. But here, I dont want to create any application, just the lib (similar to a shared library I would create in C using Makefiles/autotools).
Also, A library in Android world is basically a jar file (like we have *.so in C), right?
1) While Android tools does accept/use Java JAR files, JARs don't contain Android specific stuff like resources (bitmaps,xml) as well as the necessary meta-data to properly merge all of that into a client project. So with the 'new' Gradle based tools we now have AAR format http://tools.android.com/tech-docs/new-build-system/aar-format and the toolchain knows how to handle them.
2) Which brings you to Create aar file in Android Studio
I am trying to add Support Library v7 to my clean android project as support library (with resources). I followed every instruction here: http://developer.android.com/tools/support-library/setup.html#download and android.support.v7.* package is not visible in my main project.
Here is library reference in main project:
Support library project tree:
Support library project build path:
And finally, my main project tree
I don't see any errors in Problems tab, app compiles and runs normally but i cannot import android.support.v7 package which apparently isn't in build path in main project. I went through instruction twice in clean projects/workspace. I cleaned project, restarted Eclipse and nothing... All resources from library project are unreachable too.
Thanks in advance :)
Copy the library project to the folder where your android project is.
Select File > Import.
Select Existing Android Code Into Workspace and click Next.
Browse and import the same to eclipse
Once the library project is imported you can refer the same in your android project.
This is similar to setting up google play services in eclipse described here. Check the 4th step
http://developer.android.com/google/play-services/setup.html
It looks like android-support-v7-appcompat.jar is missing from your libs folder.
When you download the Android Support Library through the Android SDK Manager it makes the support .jar files you need available under {SDK Location}\extra\android\support.
To use the v7 files, copy these to your project's /libs folder.
android-support-v4.jar
android-support-v7-appcompat.jar
android-support-v7-gridlayout.jar (*if needed)
android-support-v7-mediarouter.jar (*if needed)
Typical gotchas (this looks OK in your setup):
Make sure the min SDK is at least API 7
Make sure the project target build is at least API 17
For more information about using the support V7 package (including running the v7 samples) can be found at the RHM Guide to Android Support Lib.
The issue seems to be in Absolute path in case of Windows base machine. I faced the issue of referencing support libraries When I moved Eclipse and related libraries to different drive than where the project was.
Copy paste the libraries to folder on same derive in a way that it can pick by relative path.
..\androidCommonlib\appcompat
android.library
I am using Eclipse to develop an Android board game.
I have developed the UI in an Android project.
On the other hand, I have developed the AI in a regular Java project, because I wanted to be able to test it without all the constraints of the Android emulator (I didn't find any other way to run the code using my Windows JVM).
Now comes the times when I want to 'join' both projects (which work fine independently), that is to use the AI Java classes from the UI.
This is what I have tried:
In my Android project Properties > Projects References, I ticked the Java project.
This allows me to build without error the Android project (which instantiates an AI object).
But it fails at runtime with this error:
Could not find class 'my.package.AI', referenced from method my.otherpackage.UI.onStart
What would be the correct way to include the AI Java Project into my Android Project ?
(NB: I still want to be able to develop and test the AI as a regular Java app, so I think using a jar or copying all the sources to the Android Project would not suit my needs)
EDIT:
I was hoping that the new ADT v17 would solve the problem, but it didn't. I have tried virtually every option available to include a project in my Android project:
Adding or linking a source folder
Adding a Project (Java Build Path > Projects tab)
Adding a Class Folder or a Library (Java Build Path > Library tab)
Ticking all the previously imported projets/libraries as Exported
The only way that allows compiling and running without error is adding the JAR of the Java Project to the Android project build path.
Projects References only add the dependent project source code (your AI project) as a soft (perhaps weak is a more accurate word) reference, your AI project is not added into you Android Project Build path. so the actual ai.jar is not exported into the final apk when Eclipse build your app.
You should add AI project into Android project build path:
Right-click on your android project, select Build Path - Configure Build Path, in Projects tab (Required projects on the build path), add your AI project here.
Then in Order and Export tab (Build class path order and exported entries), tick your newly added AI project appeared int the list.
Step 2 is probably optional, this should add AI project as a reference in Android project and export the ai.jar to final.apk when Eclipse build your Android project.
Update from ADT 17.0.0:
Android Dev Team just release SDK r17 with ADT 17.0.0, which claims to handle this use cases properly now:
Eclipse specific changes
The dynamic classpath container called “Library Projects” has been renamed to “Android Dependencies” as it now contains more than just Library Projects.
The container will now also be populated with Java-only projects that are referenced by Library Projects. If those Java projects also reference other Java projects and/or jar files they will be added automatically (jar files referenced through user libraries are supported as well).
Important: this only happens if the references are set to be exported in the referencing project. Note that this is not the default when adding a project or jar file to a project build path.
Library Projects (and the content of their libs/*.jar files) is always exported. This change only impacts Java-only projects and their own jar files.
Again, duplicates (both projects and jar files) are detected and removed.
More in this link.
Edit: After much testing, reading and found my solution. Problem is (as of this writing) that you can't reference another project from an Android project, although it works fine for a normal Java application project.
Workaround for me (Windows with NTFS filesystem):
In a prompt (admin rights) make a symbolic folder link using mklink /D command pointing to your source project folders, and refresh in Eclipse as needed.
The obvious limitation is you cant use the same package names in source project and target project, and then there is the problem with libs in the common project.
example:
cd \java\workspace\AndroidProject\src\your\package
mklink /D common c:\java\workspace\CommonProject\src\your\package\common
Clarification: You can reference another project from an Android project to make it compile, however when you run, the referenced classes from the included project are not put in the apk classes.dex (verified with dex decompiler).
Using ADT 21.0.0 64bit on Windows 7 64bit. I tried adding project to build path. Ticked in the Order and Export, played with order. I read the official solution, the detailed explanation of that solution, exported as JAR, added to libs. Did not work, while the source was without errors. Read in the comments that the solution didn't work for everyone.
Was fed up with it and tried a simple but somewhat messier solution: linked the Java project's source to the Android project. That did the trick. Hope that this will help others too.
Don't add it to the project references area, instead go into the Android pane (in the Project Properties), scroll down to the bottom, and add it under Libraries.
This sometimes works but sometimes produces bizarre Eclipse issues (not sure why), in which case copying the jar directly into the project seems to work best.