OK, I've started doing some Eclipse plugin development.
I've got my own custom icon in the toolbar.
When clicking the icon, I'd like to show the following screen to the user:
I have an IProject object of the Android project I'd like to launch.
Unfortunately, there's no simple IProject.launch() method...
What I've done so far is cloning the ADT source from here
git clone https://android.googlesource.com/platform/sdk
and started copying over all the necessary parts.
There must be an easier solution than this?
Can't I just hand over the launch of the project to Eclipse / ADT Plugin?
If you only need to change some of the Java code directly before the user launches the project, you can go an easier route: Just implement an additional project nature and an additional project builder. Then add the nature and the builder to your specific projects. Make sure your new builder is before the other builders in the project builder order, like in the below screenshot
Everything else works like before. That way your plugin is like every other large plugin. E.g. the Android tools also do some magic first and then the normal Java builder is invoked, instead of re-implementing the Java stuff.
Related
I downloaded this git repository: https://github.com/jitsi/libjitsi
It contains two examples, but when I try to run them, the run button is disabled:
When I select in the menu "Run" -> "Run", it tells me to add the edit configurations for the app and this window opens, but I don't know what to select there:
I found this additional site referring to the examples (when you scroll down a bit under examples and API):
https://desktop.jitsi.org/Projects/LibJitsi
Those are designed for use from the JVM, such as on a desktop or server. They contain main() methods for use with the java command. They are not Android apps and cannot be run from within Android Studio on Android devices.
It seems that the project is not imported in a good way as in an Android Project and the reason for that is, It is not an Android Project It is just a basic java library.
If you want to add this functionality you can export the JAR and then add it as a library to your existing Android Project.
And if you want to clone some project from GitHub the better way could be:
File -> New -> Project From Version Control -> Add the Git Repo Link
It seems this is a library that is usually added as a dependency to another application. This library can however also be run as a standalone Java application. I'll leave to you whether that is the desired way to use this library, you can also consult the library documentation.
You can find how to run a Java application in IntelliJ IDEA in the documentation here:
https://www.jetbrains.com/help/idea/running-applications.html
https://www.jetbrains.com/help/idea/run-debug-configuration.html
I'll explain it my way.
To start a standalone Java application in IntelliJ IDEA, you need to "Run" the class with a public static void main(String[] args) function. In this project there are several, each with a different purpose. Use the project documentation and their JavaDoc to find out which one you want.
For this answer, I'll use org.jitsi.sctp4j.SampleClient which, according to its JavaDoc, is:
Sample SCTP client that uses UDP socket for transfers.
There are two ways to go about Running it. I'll start with the way I usually use.
Open the class in IDEA. You will see a green triangle next to the class name and also next to the main function. Both do the same thing.
Click it and select "Run 'SampleClient.main()'" from the dropdown menu:
You can see the result at the bottom in the "Run" tab. That's it, at least for this class. The application should start successfully. You can stop it just like in Android Studio, using the red square either in the Run tab or at the top right in the navigation bar. Some applications will just perform an operation and stop on their own.
This class does not need any arguments for its main() method. If it needed them, we would have to add them in the Run Configuration...
And that is where we'll go for the second way to Run an application.
You will need this way if the main() method requires any arguments. You can also use it instead of opening the class file in the first place.
If you used the first method to start the application, you will see a Run Configuration already created for the SampleClient class. You can use it to run the application from the navigation bar, just like in Android Studio. You can also open the dropdown menu and select "Edit Configurations" to modify it or add a new Run Configuration:
You can modify the configuration created for SampleClient - add program arguments, environment variables and more.
To create a new configuration, click the "+" icon and (in our case) select the "Application" type. Other types of Run Configurations include JUnit tests, Maven tasks, server deployments and more:
In the "Main class" field, either manually enter a qualified class name (code completion also works), or click the "..." on the right and select a class from the list of classes with main() methods:
You can again add program arguments and more. When you're done, you can use the configuration from the navigation bar.
Visual Studio 2015, Update 3.
Create a blank solution. Choose Add New Project -> Visual F# -> Android.
Create either a Blank App (Android) or a Unit Test App (Android).
The app is created successfully.
Right click on References, and choose "Add Reference". The following dialog box pops up:
Note that when you look at the Project Properties, there are two "Application" tabs. The second one generates an error:
Once the project has been unloaded, it can no longer be reloaded. The resulting error message is:
I have reported this on the Xamarin Forums, but the process is slow. I'd like to find a workaround, but I'm fumbling in the dark. Once I've unloaded the fsproj file, I can't find any mention of "frameworkName", and I can't reload it either.
My Android settings appear to all be up to date:
Does anyone know of any workarounds that will allow me to start unit testing my existing app?
I believe I have a fix for this issue :)
Xamarin expects F# 3.x to be present, which at this point must be manually added. You should be able to download F# 3.x here
Please let me know if this fixes the issue for you.
Thanks!
Edit: I have filed the following bug as well: https://bugzilla.xamarin.com/show_bug.cgi?id=42970
When using the the new activity wizard for an Android app in Eclipse
File -> New -> Other -> Android -> Android Activity
I get the warning
This template requires a minimum SDK version of at least 11, and the
current min version is 8
This happens for most of the options in the wizard but right now I want to create a new master detail activity which will make use of fragments.
I am using actionbar sherlock and I have the latest support library jar registered with the project. I would like to use the wizard as fragments are new to me and it seems like a lot of code is needed that I am unfamiliar with. So I'm using the wizards as both a learning process to understand how fragments should be implemented properly and fault free, which is something I'm not confident of doing manually just yet.
It seems to me totally obvious that I should be able to tell the wizard to make use of the support library methods and classes but I can't seem to figure out how to do this.
I could just change my min sdk level to 11, use the wizard, change the min sdk level back to 8 and make the support library changes that are needed but what a pain!
Update
How would I go about changing the source code of either Eclipse or the android sdk to achieve this as both are open source right? Where should I start looking?
Any ideas greatly appreciated
Unfortunately, the answer is no.
The New Android Application wizard does not allow you to select / add third party support libraries to your project while creating a new project. The only library it will add by default is the android-support-v4.jar library.
It is a small trade-off I suppose. The new wizard, especially the Android Activity, does simplify things when creating new Activities quickly. But I suppose, it is something we will have to live with until Google adds such a provision. That is, if they choose to add it sometime down the line.
Update 1
Eclipse is Open Source. These are all the sources available for the Eclipse Source: http://git.eclipse.org/c/. However, I don't think modifying Eclipse would be helpful. I am almost certain, it is more ADT's / SDK's doing than Eclipse per-se. But I am merely speculating on this one.
Update 2
You can download the SDK source from here: https://android.googlesource.com/platform/sdk/. Good luck. :-)
I am implementing menus using TWL (http://twl.l33tlabs.org/) in an app written using Libgdx. The app runs fine if I don't start any menus, but as soon as I go to a menu screen it immediately force-closes. Menu screens work fine on the desktop version.
In which build path should TWL-android.jar be included (right now it behaves the same in main, android, and both)? And how will the program know to use the libraries from this .jar instead of the default gdx-twl.jar? Will I have to manually implement something in code to use one or the other depending on platform?
There does not seem to be any documentation or sample code of anyone using TWL on android, only mentioning that it can be done.
Running debugger attached to phone gives the following logcat error:
Could not find class 'com.badlogic.gdt.twl.Layout' referenced from method com.Nanners.OptionsScreen.<init>
I think that TWL-android.jar should be added to android project's build path too. Location of .jar is not relevant.
When you add TWL-android.jar. As that is Android specific you can't use it on the core project, so the classes you are importing are the ones from gdx-twl. To make it simpler to explain I will divide it in different escenarios.
You add TWL-android to your Android buildpath. But you use Gdx-twl in your core project. Which isn't added. Thus getting a:
Could not find class 'com.badlogic.gdx.twl.Layout'
You add both TWL-android AND Gdx-twl to your build path. Thus getting duplicated classes and:
Conversion to Dalvik format failed with error 1
Solution
If you use TWL-android classes, you can only do it inside the Android project:
Merge Core, Desktop and Android project. Or
Use Interfacing with Platform Specific
If you use Gdx-twl:
Don't do it.
Actually the best solution is to get rid of all twl stuff and use Scene2d.Ui instead. Its crossplatform and much easier to use.
I'm trying to add the facebook SDK to my project but it won't work at all.
I've followed the official steps; opened the fb sdk, made sure it's set to "is library", in m yown project go to properties->android->add library and it lets me select com_facebook_android and it shows up with a green tick next to it. HOWEVER, when i go back to that screen straight away it now has a red cross next to it, and if i try to launch the app in the emulator it has " com_facebook_android] Could not find com_facebook_android.apk!"
(This is just me testing without referencing the library in my app)
if i DO reference the library, then any calls to the facebook library give an error within eclipse and the tooltip suggests to add it to build path, so if i click that it launches fine, but still does the above apk error and the app force closes on any activity which references facebook.
As far as I can tell I'm following the official instructions fine but it just keeps coming back to that red cross in my app's properties
Does anyone know what this could be?
Not sure why you have the issue, i've setup a empty project with facebook library in it, if you have no luck then try downloading that, unzipping it and importing exsiting project into workspace.
link : Download here
you know what i have done one trick to use the official facebook SDK in my application, i have created com.facebook.android and add all the library classes into it. Then i can easily reach to access any class whenever i want it. This can be a way to use the classes inside your application instead of using Library.
Its running fine in my case.