My experience (Build love-android in Windows)

A project to port LÖVE to Android handhelds
Locked
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

My experience (Build love-android in Windows)

Post by Positive07 »

I will explain how to setup a deployment environment in Windows.

EDIT: Added this to the wiki

As you may already know making a native Android app with the new love-android-sdl2 it's not so simple and it's wiki explains how to do it in Arch linux (with console commands mostly) :death:. A tutorial for Windows hasn't been made yet so I'll try to explain the process. :awesome:

First I downloaded the Android SDK (as the wiki states is a needed step) to do this I went to Android Developers Download page. WARNING the "Download the SDK" link is not the one you have to click (learned this the wrong way), that links directs to a pre-set environment and we want to make our own one. The link you should click is in the "Use an existing IDE" section there you can click the download link and get the SDK tools. Keep this tab open we are gonna use it quite a bit.

So then I tried to install it BUT it requires to have the Java SDK (JDK for short). To get the JDK I went to the "System Requirements" section of the Android SDK page. There I found a link to the JDK download page.
You have to click the first option (without netbeans) and should be redirected to the downloads, scroll down ACCEPT THE LICENSE AGREEMENT (it's pretty easy to don't see it), and then click on the correct download link ( Windows 32bits jdk-7u51-windows-i586.exe, Windows 64bits jdk-7u51-windows-x64.exe)
NOTE: I had some troubles with this downloads that didn't let me install the JDK but I tried many many times till I got it right (you can check the file integrity with the checksums Java provides)

Install the JDK (You know... Accept Accept Install Finish :megagrin:). Then install the Android SDK Tools (Don't run it yet we are gonna respect the steps as they are in the wiki page)

Now in the Android SDK page in the Requirements section you can get Apache Ant. Once you are in the main page you can go to the Downloads section at the right, click the Binary Distributions link and download the .zip archive (you can find it in the "Current Release of Ant" section)

Once you get the zip you can unzip it wherever you want. I placed it in "C:\Ant" but I think that anything will do.
NOTE: inside of the zip there is a folder so if you unzip it in "C:\Program files" the path will be "C:\Program Files\apache-ant-x.x.x".

Now lets get back to the Android SDK page to get the NDK (NDK requires the Android SDK but you already have that). At the left sidebar in the Downloads section there is an option that says: Download the NDK
Click on it and download the 32bit or the 64bit version depending on your system.
Okey so here we have other zip file that can be uncompressed wherever you want (just remember where you left them).
For this zip I made a folder in my user folder (since its not really an app but a library) "%USERPROFILE%\bin\android-ndk-r9c"
NOTE: This file is also a folder inside a zip.
NOTE2: There are almost 30000 files (maybe more) in the zip so it will take a lot of time :(

We are almost there

Now it's time to install the Android Components. To do this open the SDK Manager
Start > All Programs > Android SDK Tools > SDK Manager
Might take some time to start up.
In this checkbox list you have to select the following items:
  • Android SDK Platform-tools API 19.0.1
  • Android SDK Build-Tools API 19.0.1 (or API 19.0.2?)
  • Documentation for Android SDK API 19 (I don't really think you need this but whatever)
  • SDK Platform Android 4.4.2 API 19
  • Samples for SDK API 19(not really needed either)
  • ARM EABI v7a System Image API 19
  • Google APIs ARM System Image API 19
  • Sources for Android SDK API 19
  • Android Support Library
  • Google USB driver
Install the pakages - Accept License - Install - Wait again :x

This is driving me crazy :crazy:

Okey so it's time to get the repo . You have a Git client? perfect use that (I don't have one so I cant help you but you can look at THIS). If you don't have one like me, follow this steps:
-Go to the Downloads page of the bitbucket repository
-Go to the Tags tab
-Select the "beta2" (or most recent version) .zip file and star downloading it
-Uncompress the file wherever you want, again this zip has a folder with the same name as the zip name inside of it (kind of inception), I puted it in %USERPROFILE%\repos\love-android-sdl2

We now have every single file you'll need... it's time to set ENVIRONMENT VARIABLES!! Yeah!
So... what's that anyway? Environment variables define constant variables inside of the OS that you can easily call in a shell.
e.g. %USERPROFILE%, %PATH%, etc.
It took me a while to understand how to set this variables since there are many ways to do so, I'll go for a "hard one" because I'm trying to do everything without using a shell.

So press Windows key + the Pause key (or go the My Computer right click and Properties)
NOTE: I imagine you have administrator privilegies (if you don't then this might be a little tricky and you should look how to do it somewhere else) but since you could install all those app you should have them.

Select "Advanced" in the left sidebar and at the bottom of the prompted window it will say "Environment Variables" click on it
So there are two types: User's and System's, I couldn't make User's variables work so I'll use System's (if you were able to use the User's ones please tell me)

WARNINGNOTE: I tried using %USERPATH% and other environment variables inside of the value fields but this didnt work so I had to change them for the full path (C:\Users\YourUsername\) so whenever you see an environment variable you should change it to its full path (just to be sure)

Here we will define some new variables so click New (under system variables) and put this:

Code: Select all

Name:ANT_HOME
Value: C:\Ant (or whatever directory you used for ant)
Click New again but this time:

Code: Select all

Name: JAVA_HOME
Value: C:\Program Files\Java\jdk1.7.0_51 (or your java directory)
Lets add other one with New

Code: Select all

Name: ANDROID_SDK
Value:  %LOCALAPPDATA%\Android\android-sdk (or your android-sdk path)
Same value different name

Code: Select all

Name: ANDROID_HOME
Value: %LOCALAPPDATA%\Android\android-sdk (or your android-sdk path)
other for the NDK

Code: Select all

Name: ANDROID_NDK
Value: %USERPATH%\bin\android-ndk-r9c
and another one (althought I am not really sure about this one)

Code: Select all

Name: ANDROID_SWT
Value: %ANDROID_SDK%\tools\lib\x86 (or x86_64 in 64bits systems)
Now search in the list for the PATH (Path) variable
Click it and then click "Edit" now in the value field you will get some text right?
e.g.: C:\Windows\System32 (It should be longer but doesnt matter)
Now you have to add something and to do so you'll do this:

Code: Select all

OLDTEXT+;%ANT_HOME%\bin;%ANDROID_SDK%\tools;%ANDROID_NDK%
Where OLDTEXT is the original value of the variable, the plus shouldnt be there, there should be no space between the OLDTEXT and the semicolon and no space between the semicolon and %ANTHOME%\bin;%ANDROID_SDK%\tools;%ANDROID_NDK%
NOTE: Dont put any type of quotes ( " ' ) they are prohibited

Now we are done with environment variables lets keep going

Then I just went to the repository folder and created a new text file, I named "build.bat" (I changed the txt extension for the bat extension since this is a shell file)
inside of it I wrote

Code: Select all

ndk-build
rem You could specify the numbers of cores of the computers by replacing "ndk-build" for "ndk-build --jobs n+1"
rem Where "n" is the number of cores. I didnt test it on Windows so I dont know if it works as it should
pause
You can use any text editor for this

I then clicked on the file and the building process began (And if you were tired of waiting! :death:)

Now you should check the wiki on how to deploy your own game instead of the no-game app

Then you can just create another text file in the repository folder and name it "whatever.bat" (PS: Dont name it "ant" it will brake) deleting the ".txt" extension of course and inside of it you write

Code: Select all

ant debug
and you can run it whenever you need to deploy an android game :cool:

Did you write in a console? I didn't :awesome:

If you had a problem/made a mistake/I used a non-efficient way/or didnt explain something please tell me I'll do what is in my grasp

- Positive -
Last edited by Positive07 on Mon Mar 03, 2014 5:05 am, edited 2 times in total.
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
fysx
Citizen
Posts: 97
Joined: Mon Jan 30, 2012 8:36 pm
Contact:

Re: My experience (Build love-android in Windows)

Post by fysx »

Wow! Thanks for the very detailed instructions!
Bird thing: @fysxdotorg Blog thing: fysx.org
User avatar
Dashchan
Prole
Posts: 4
Joined: Sun Sep 15, 2013 10:46 am

Re: My experience (Build love-android in Windows)

Post by Dashchan »

I got this problem while executing "ant debug"
I had been searching for it, but i didn't get a right solution

Can anyone help me?

+ line 698 of build.xml is "proguardFile="${out.absolute.dir}/proguard.txt">"
+ can't find proguard.txt
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: My experience (Build love-android in Windows)

Post by Positive07 »

fysx wrote:Wow! Thanks for the very detailed instructions!
No problem fysx
Dashchan wrote:I got this problem while executing "ant debug"
I had been searching for it, but i didn't get a right solution

Can anyone help me?

+ line 698 of build.xml is "proguardFile="${out.absolute.dir}/proguard.txt">"
+ can't find proguard.txt
I can guess that's a problem with Ant itself. I'll look at it and tell you what I can find

EDIT: I looked at it and it seems that there is a problem with that file (althought I dont know how to replicate it)
The file proguard.txt should be inside of the bin folder inside of love-android-sdl2 repository
Did you have some kind of problem with ndk-build maybe? I cant really tell what is wrong

EDIT2: Okay I'm starting to think there is another problem here have you edited the icons? if so the directory
should always be like this

Code: Select all

love-android-sdl
    res
        drawable-hdpi
            ic_launcher.png
        drawable-mdpi
            ic_launcher.png
        drawable-xhdpi
            ic_launcher.png
        ...
Dont edit their names, their folder, or some kind of property that may affect them or it'll break
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Dashchan
Prole
Posts: 4
Joined: Sun Sep 15, 2013 10:46 am

Re: My experience (Build love-android in Windows)

Post by Dashchan »

Positive07 wrote: EDIT: I looked at it and it seems that there is a problem with that file (althought I dont know how to replicate it)
The file proguard.txt should be inside of the bin folder inside of love-android-sdl2 repository
Did you have some kind of problem with ndk-build maybe? I cant really tell what is wrong
After deleting all files and executing "ndk-build", It works well (I don't know what was wrong :huh: maybe it's related to "ndk-build" as you said)
Thank you for helping me! :awesome:
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: My experience (Build love-android in Windows)

Post by Positive07 »

Dashchan wrote: After deleting all files and executing "ndk-build", It works well (I don't know what was wrong :huh: maybe it's related to "ndk-build" as you said)
Thank you for helping me! :awesome:
Awesome!... No problem... I kept looking at it but couldn't really find what was wrong. The aapt (an Android tool) wasn't compiling the resource files but I don't really know why, maybe ndk-build didnt generate a file related to that or something. I can't tell.

But it works now so... that's great
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Locked

Who is online

Users browsing this forum: No registered users and 2 guests