An alternative way for building a Unity project for Android - android

For the last few days, I have been trying to build a testing project for android using the default build method but I just keep recieving errors and not knowing how to fix them.
Short Error and Full Error Decscription. Also I am using Unity 5.6.7f1 with Admob plugins (And yes because my pc is shit so I use this version)
So I want to ask is there an alternative way for building an android app with Unity. I have heard about exporting the project to gradle and building it using Android Studio. But I don't know how.
If you know an alternative way or how to build the project with Android Studio or how to fix the error PLEASE ANSWER. I am having a nightmare with building this stupid test project to Android

The problem is your jdk(1.8.0_311) is too new to support legacy build command from Unity (5.6.7f1).
Two method to solve:
Install older jdk
if you don't know which version you should use. You may use the default jdk with Unity installer in preferences. (I'm not sure 5.6.7f1 is supported).
Export android project
You can export android project by check the "Export Project". Then use android studio to build apk.

Related

Android Studio - Plugin Too Old (Gradle)

Quite new to Android Dev, and I've been getting a strange error recently. I've searched online, and nothing seems to do the trick, so while I understand that this might be a duplicate question, no other previously asked question was able to offer me a working solution.
When I make a new project in Android Studio (version 2.2 Preview 1), I get bombarded with the error:
Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "84c9986024dd3d7a4767dc5c38710ff1b96f1a21"
With two options: "Fix plugin version and sync project" which seems to do nothing. Upon clicking. And "Open File" which just opens the "build.gradle" file.
In my settings, I have Android Studio set to use the default gradle wrapper. I even set the distributionurl to the newest gradle version, but apparently even that is "too old"...
I have no idea what's causing this problem.
Another peculiar thing I've noticed is that in the project panel, it seems that my project doesnt look as it should.
The project in question looks like this:
Whereas, I understand that it should look more like this:
Again, no idea what's going on... I'm pretty new to Android Studio, but I'll do my best to answer any questions you may have.
While I believe the message may be because you have a 2.2 Preview build of Android Studio, it may want you to use a beta build of the Android Gradle Plugin.
Note: This is not related to the version of Gradle. The latest supported version of Gradle is 2.14.1, which you can check the Android Studio Release Notes, and also here.
From that first link, what I find most people don't understand.
The plugin runs independent of Android Studio so the plugin and the Gradle build system can be updated independently of Android Studio
Or Configuring your build, which explains why they are separated.
you can build your Android apps from within Android Studio, the command line on your machine, or on machines where Android Studio is not installed (such as continuous integration servers). If you are not using Android Studio, you can learn how to build and run your app from the command line. The output of the build is the same whether you are building a project from the command line, on a remote machine, or using Android Studio.

Building Android app with Jenkins & Gradle

I'm a devops engineer, and my company is building their first Android app. For all of our other projects, we've used Jenkins to handle builds.
I've read quite a few tutorials on getting android building on Jenkins and they all seem to rely on Gradle. I'd like to get out in front of the devs a bit and start the job. Is it possible that the app that they build doesn't support Gradle? What scenarios are those, so I can influence decisions?
Maybe Gradle isn't the latest thing, if not, what is?
Is it possible that the app that they build doesn't support Gradle?
It is possible that they are not currently building the app with Gradle, but highly unlikely that the app could not be built with Gradle.
What scenarios are those, so I can influence decisions?
The most likely scenario where they are not building with Gradle, is that they use the Eclipse IDE to develop the app. Eclipse projects have historically been built more often with Ant or Maven. But an Eclipse project can be built with Gradle. That said, configuring an Android project to be built with Gradle is not a requirement to build that project with Jenkins. Ant, Maven, and other build tools play nice with Jenkins also. So, if your dev team is using a build tool other than Gradle, that shouldn't be a blocker for you. You should be able to accommodate them, if that's going to cause less friction.
Maybe Gradle isn't the latest thing, if not, what is?
I'm not sure about latest, but Gradle does currently have a lot of momentum as the build tool of choice for Android projects because it is the default build tool for Android Studio (which is positioned to replace Eclipse as the default Android IDE).
So, my advice would be to ask your dev team what IDE and build tool they are currently using, and go from there... (if they use Eclipse and you want to build with Gradle: Is it possible to use the Gradle build system for Android with Eclipse?)
Source: At the company I work for, I develop two Android apps and make daily builds with Jenkins. A few months ago I switched from Eclipse (Ant) to Android Studio (Gradle).
I hope this was helpful. I have not answered many questions on here so I'm not entirely sure I'm doing it right. :)

How can I use Android Studio 1.0 without Gradle or Maven?

I just want to start a simple Android project and quickly make changes and install it on my phone using simple right-click --> Run as an Android application.
I could do this in Eclipse but I really like Android Studio's (i.e. IntelliJ IDEA's editor features). But because Android Studio has all the Android dependency bundled with it I decided not to install IntelliJ IDEA and rather went with Android Studio 1.0.
I am getting plethora of errors with Gradle which I am not even adding in my project while trying to start one, neither can I find a way to remove Gradle from my project. My Android Studi 1.0 installation is standard installation on Windows 7 and I can see gradle 2.2.1 in plugins folder but it just doesn't work. I expected everything to work out of the box as its just a dummy app with default UI components selected from SDK while creating the project.
Is there a way to simple app building experience in Android Studio without dealing with Gradle and its dependency and set-up?
Android Studio uses Gradle as its build engine. There is no way to use one without the other. That said, the "New Project" wizard should get you up and running quickly.

Configure Eclipse for Phonegap build

I am new to Phonegap and have succesfully created my first app and compiled first on-line then set up phonegap, android SDK etc locally so I can build and run the app in the emulator using 'phonegap run android' at the command prompt (windows).
For an IDE I installed Eclipse and imported the project. I can now run the project from within Eclipse.
However I am really struggling with the Eclipse build. It's taken days already to solve all the problems and get to this stage but I've reached the point where I can't make progress although it would seem so simple.
The build project option is disabled. It turns on if I add something under 'Builders' under 'Configure Build Path...' but I have no idea what I should be doing here.
I can go back to the CMD prompt and build, refresh in Eclipse and run the modified version but this can't be the right way to do it?
I just need to tell Eclipse to 'phonegap build'. But how?
When you create a project using PhoneGap it creates a Gradle based build which can be opened in Android Studio or IntelliJ IDEA. I recommend using Android Studio for PhoneGap projects.

Migration from Eclipse to Android Studio

So,
as it seems that more and more people are using Android Studio i got curious and wanted to take a peek at it.
I have used Eclipse up until now and wanted to migrate a project to Android Studio. So i exported a gradle buildfile from within Eclipse, as android.developer.com suggested.
That worked fine, now i wanted to import that into Android Studio 0.3.2
When trying to import i got that Unable to import Eclipse project to Android Studio error. Now it is building.
But it got a new suprise, now before it is finished building, its asking specifically for an older Version of Gradle(1.6)... Ok, i can do that. Which leads me right back to the first error. So i tried this - Gradle version 1.6 is required. Current version is 1.8-20130730220035+0000
I can however create a New Project with Android Studio.
I've tried this for about an hour now and im getting sort of pissed, because it doesnt seem to know what it wants. Is it some sort of Bug or did i make some sort of mistake.
You're using a very old version of Android Studio. I'd recommend upgrading to 0.4.3. Versions later than 0.4.0 allow direct import of Eclipse projects instead of requiring you to do the cumbersome (and as you've seen problematic) export of projects from Eclipse; it's smarter about setting up the right plugin and Gradle versions. 0.4.3 has some important bugfixes over 0.4.0-0.4.2.
I've just migrated my projects. Here is two suggestions from my side.
Take the latest Android Studio.
Do not export / import projects from Eclipse. Most likely you are going to have errors in the project after this step. Starting from a clean project, which builds, will safe you a lot of time and avoid unnecessary frustration.
Create an empty Android Project in Android Studio. It must build without errors (⌘ F9). The start to enhance it using official Gradle Plugin user guide.
Create libraries folder and add all libraries in there one by one. Update build.gradle dependencies as mentioned in user guide. Make sure everything builds successfully.
After all libraries build you can copy-paste sources, resources and assets from Eclipse project to corresponding folders of Android Studio project. Make sure everything build as expected.
Now you can start with more advanced configuration like ProGuard configuration, release certificates etc.
I've done it in a couple of hours. Hope this helps you too.

Categories

Resources