Gen folder empty - Java for Android App Development

Whenever I create a new Android application project, my gen folder is missing thus giving me the error of R cannot be resolved to a variable.
I've searched around and tried cleaning and building but that did not fix the issue.
Has anyone dealt with this issue before? If so, how did you fix it?
Thanks

I had this issue when there was an error in one of my xml files. Have a close look at every layout again.

nikwen said:
I had this issue when there was an error in one of my xml files. Have a close look at every layout again.
Click to expand...
Click to collapse
I've also read somewhere that it was the xml files causing this issue.
Could you clarify if I should only be looking at the xml files in my layout folder?
Thanks

InfiniteStratas said:
I've also read somewhere that it was the xml files causing this issue.
Could you clarify if I should only be looking at the xml files in my layout folder?
Thanks
Click to expand...
Click to collapse
There should be a red X in Eclipse if there is an error. Sometimes it just appears in the file but not in the project tree.

Since the new sdk update (22) I need to check all boxes under project properties - java build path - import / export.
Taptalked u see .. əəs n pəʞlɐʇdɐʇ

I've had a similar issue some days ago. My R.java was not regenerated after I cleaned my project.
Here is what fixed it for me: It seems like as of SDK version 22, which I had recently downloaded, there is an additional package you have to download from the SDK manager called "Android SDK build-tools". I installed it, restarted Eclipse and everything was working again.:good:
I had found the solution on StackOverflow: http://stackoverflow.com/a/16643060/1691231

Check for any XML Errors Drawables/Layout/Menu/XML (Major issue in Eclipse)
As mentioned above, Update to latest SDK and Add-ons from the SDK Manager and Eclipse Updater
Remove any R.Android Imports in your Java Classes
And make sure your using a capadible fit version of Eclipse for android Development. Easiest Setup is to use the ADT Combo Package (Altho consumes more Ram)

Related

Development: Files to APK....?

Hi,
Sort of new in the development world, been workign with some examples and changign some files around , but i have no apk yet.
I have all the folders, and files. as in the picture enclosed
-Assests
-bin
-gen
-res
-src
-.classpath
.project
AndriodManifest.xml
default.properties
So my question is.
How can i make this into an APK file? I have the files, already made and since the example was provided to me in ZIP file, i dont have many options..
I know and read that i would need eclipse etc for programming, but i figure the program is already made Just not in APK
so how do I make this an APK file?
I tried Apk manager, but u need an APK for it
Uhm, yeah, I don't think this is going to work like that. Install eclipse, ADT plugin and import the Project and then you can try to build the apk!
You cant compile code into an executable apk without a development environment, such as eclipse.
Sure you can. Check out:
http://developer.android.com/guide/developing/building/building-cmdline.html
I would STRONGLY suggest you install eclipse (or equivalent) because it makes things so much easier. You'll struggle otherwise.
An APK can be made, completely from scratch, from the command line but why on earth would you want to?
Yeap, eclipse does everything.
You can compile it on an AVD via eclipse, or even straight to your phone, if you connect it by the time you run the program in eclipse.

[Q] getting Application Name from APK file

Hi
I have a folder with +2000 apk files and they named like 'app.apk' , 'app1.apk' , and many more like this. so I want to make a software that rename these files like this
app.apk ---> <ApplicationName> <version> .apk
so I need a way to get the application name from the package
I already tried decompiling xml file but there is only package name
I searched xda and google for this matter and no luck....
can you help me to get the application name?
Run "aapt d badging some.apk" and search for "application: label=". aapt is a part of SDK.
Brut.all said:
Run "aapt d badging some.apk"
Click to expand...
Click to collapse
Thanx for this very useful.
There is a script by phsorx that automates this
If you're really in a pickle you can put the apk on your device's sd card and run it. It will show you the app name and permissions before actually installing.
This method would be tedious and painful, but effective.
Comin' at you from Dead Space. 2, that is.
apkspy
or run this:
http://forum.xda-developers.com/showthread.php?p=14523375
it does exactly what you want.
I'm the author btw.
I use aapt.exe from latest SDK. Some apk doesn't show a label or a valid english label.
(Android Asset Packaging Tool, v0.2-3303571)
Your have to use the old version of aapt.exe that work great!
(Android Asset Packaging Tool, v0.2)

[Linux][UTILITY][TOOL] APK Multi-Tool

GgI am currently working on a major update to the apk manager application as well and changing the name to APK Multi-Tool with some new added features and also to fix some issues with some code errors.
I am also changing a lot of the features as well since a lot of the code has been outdated for a while.
I have updated all the files and modified Apk manager's Scripts to fix many user reported bugs from Daneshm90 apk manager which he had written a simple script to ease the process of editing apks. Got a lot of downloads so thought its in demand
Whether you're doing basic image editing or editing the smali or xml files, on average u have to use (Brut.all or JF's smali/baksmali) awesome tool to extract the apk, edit it, then sign the apk and then adb push/install it. This process is quite tiresome if you are testing a method that needs fine tweaking.
This script should make the process a LOT smoother.
Theres an option of compiling/signing/installing all in one step
Thanks:
Goes to Daneshm90 the Original Writer of APK Manager
Goes to Brut.all for his awesome tool.
Goes to JF for ofcourse, smali/baksmali
Features:
- Added framework dependent decompiling (For non propietary rom apks). (Option 10). Checks whether the dependee apk u selected is correct.
- Allows multiple projects to be modified, switch to and from.
- Allows to modify system apk's using apktool but ensures maximum compatibility in terms of signature / manifest.xml
- Batch optimize apk (Zipalign,optipng,or both)
- Batch Ogg optimization
- Batch install apk from script (option 19)
- Batch Theme Image Transfer TOOL
- Batch Theme optipng TOOL
- Batch Theme Zipalign APK TOOL
- Compression level selector (monitor status above menu)
- Error detection. Checks if error occurred anytime u perform a task, and reports it
- Extract, Zip apk's.
- Incorporates brut.all's apktool
- Improved syntax of questions/answers
- Logging on/off has been removed. Instead a log.txt is created which logs the activities of the script organized using time/date headers
- Optimize pngs (ignores .9.pngs)
- Pull apk from phone into modding environment.
- Push to specific location on phone
- Quick sign an apk (Batch mode supported)
- Read log (Option 24)
- Sign apks
- Supports batch installation, so if u drag multiple apks into the script (not while its running) it will install them all for u. U can ofcourse drag a single apk as well
- User can change the max java heap size (only use if certain large apks get stuck when decompiling/compiling apks) (Option 19)
- U can now set this script as ur default application for apks. When u do, if u double click any apk it will install it for u.
- Zipalign apks
- Much Much More
Instructions:
- Place apk in appropriate folder (Any filename will work, if running for first time folders will not be there, you must run and then the folders will be created)
- Run script
- Minimize the script
- Edit files inside the project folder
- Maximize the script
Requirements:
Java 1.7
Android SDK
FAQ
Resulting apk file is much smaller than original! Is there something missing?
First: compression of resources.arsc file. Sometimes this file is compressed in original apk, sometimes not and apktool always compress it. Second: lack of META-INF dir. Apktool builds unsigned apks, so they lack signatures stored in this dir. Third: apktool uses newest Android SDK, so it could optimize files better, especially if original app is old. So: unpack both original and resulting apk, remove META-INF from original and then compare sizes. If they're still much different, then you could report on XDA or somewhere.
There is no META-INF dir in resulting apk. Is this ok?
Yes. META-INF contains apk signatures mostly and after modifying apk in no longer signed, so there are no signatures in it. You have to sign resulting apk and then META-INF dir will be created.
What do you call "magic apks"?
Sometimes there are some apks which (for my current knowledge) are invalid, broken, theoretically they shouldn't exist. There may be many reasons of their existence: my lack of understanding of Android resources; some non-public, maybe future SDK tools or custom modifications of these; manual hacking of binaries, etc. Usually I can't do anything about it, but you could at least try to replace broken parts by something valid. Actually it's quite likely that they aren't even used, because if they would, then application would crash.
Got problems ?
1. Make sure your path has no spaces
2. Your filename has no wierd characters
3. Java/adb are in your path
4. It's not a proprietary rom's apk (aka Sense,Motorola,Samsung) (If u are, then use option 11 and drag the required framework, eg com.htc.resources, twframework-res...etc)
5. It's not a themed apk (if it is, expect .9 png errors, use as close to stock as possible)
6. Look at the log to know whats happening
7. If all else fails, post as much info as possible and we will try to assist you.
TO DO LIST
Add new feature to Randomly Generate a new Key File for signing the apk files after modifying and recompiling of the apk files this will also allow of uploading to the android market as this added feature will allow you to sign apk files that you may of compiled without signing beforehand.
Modify the Signapk script to be compatible with the Randomly Generation feature in the works
and a few other added features are in the works as I am redesigning the application and rewriting a lot of the code to fix issues as well as some of the new features have broken parts as some features have been moved and broken some command line prompts.
Installing APK Multi-Tool Itself
Instructions (Linux):
1-Download, create a folder in your sdk called "APK-Multi-Tool" and extract into it.
2-Goto the the "sdk/APK-Multi-Tool" folder and rename "Script.sh" to "script.sh".
3-Go into the "other" folder, right click on one file at a time, goto "permissions" in the new window and check the execute box.(do this with all the files)
4-To add the path to your folder open up a terminal and type in -
sudo su
PATH=$PATH:/THE PATH TO YOUR "SCRIPT.SH"
(for me this looks like the following)
PATH=$PATH:/sdk/APK-Multi-Tool/other/
5-export PATH
6-install "sox"
7-Type into the terminal "cd PATH TO YOUR SCRIPT.SH"
7.5 export PATH={PATH}:/PATH TO Your SDK/sdk/platform-tools/adb
8-Type "./script.sh"
9-You should have a running APK-Multi-Tool.
how to install sox:
Open the software center of the linux service and searched for sox. Installed it and it there you will have SOX working.
- Place apk in appropriate folder (Any filename will work, if running for first time folders will not be there, you must run and then the folders will be created)
- Open terminal and change-directory to APK-Multi-Tool(Easiest way is to type "cd ")
- Chmod 755 Script.sh
- Chmod 755 all files apps inside other folder
- Run script by typing ./Script.sh
- Minimize the script
- Edit files inside the out folder
- Maximize the script
Downloads:
https://github.com/APK-Multi-Tool/APK-Multi-Tool-Linux/archive/master.zip
Please check back daily or weekly as this project is under active Development and I am releasing Alpha releases on the website for Testing and bug reports.
Lol, why has nobody commented on this?
You're a savior. This is awesome. Can't wait for the rewrite.
AW: [Linux][UTILITY][TOOL] APK Multi-Tool
+1
Haven't seen this also available for Linux, so this is great.
Sent from my Galaxy Nexus using xda premium
Binary updates
UPDATED to apktool-cli-1.5.3-SNAPSHOT
-Updated to smali/baksmali to v1.4.2
-Fixed (issue #396) - Correctly handle android:debuggable while in debug
mode.
-Fixed (issue #340) - Fixed superclass errors on debug mode.
-Updated to Gradle 1.4
-Updated known bytes for configurations to 38 (from addition of layout
direction)
-Fixed NPE when handling odex apks even with --no-src specified. (Thanks
Rodrigo Chiossi)
-Fixed (issue #427) - Correctly handles `--frame-path` on uild
Error 404 on GitHub download page
xcly said:
Error 404 on GitHub download page
Click to expand...
Click to collapse
Fixed
Sent from my DROID RAZR CDMA XT912 using Tapatalk 2
I merged a few projects together instead of having multiple Android developer projects. I did some spring cleaning and deleted a few projects that was not useful and served no purposes. Also renamed the project organization which broke the link forgot to update lol.
Sent from my DROID RAZR CDMA XT912 using Tapatalk 2
I ran the script but I can't see any folders being created.. Trying to sign an apk. Looked up on google and all I can find is your instructions to put apk in appropriate folder (which I can't see..)
Thanks in advance
I will look into this ABCs see what's up
Sent from my DROID RAZR CDMA XT912 using Tapatalk 2
I ran the apksign tool separately using terminal for now
I got
The program sox is missing or is not in your PATH,
please install it or fix your PATH variable
If I go to the other folder there is no sox like in the windows version.
I will look into this asap once I get some free time
Sent from my DROID RAZR CDMA XT912 using Tapatalk 2
civato said:
I got
The program sox is missing or is not in your PATH,
please install it or fix your PATH variable
If I go to the other folder there is no sox like in the windows version.
Click to expand...
Click to collapse
I had the same problem but it was fixed once I installed sox. There was a tutorial on google search for setting up apk manager you might wanna have a look at.
Sent from my GT-I9300 using xda premium
raziel23x said:
I will look into this asap once I get some free time
Sent from my DROID RAZR CDMA XT912 using Tapatalk 2
Click to expand...
Click to collapse
xcly said:
I had the same problem but it was fixed once I installed sox. There was a tutorial on google search for setting up apk manager you might wanna have a look at.
Sent from my GT-I9300 using xda premium
Click to expand...
Click to collapse
I got it solved , I just entered the Ubuntu software center and searched for sox. Installed it and it works.
Maybe good to add this in OP when using linux. It is stupid of me thinking it was something harder so thank you for your help and fast response.
A other methode I found here
PS:
You don't need to type in ./Script.sh in teminal in linux , just clicking on it (Script.sh) and select "run in terminal" does the trick without typing anything.
updated the original post with detailed instructions
raziel23x said:
updated the original post with detailed instructions
Click to expand...
Click to collapse
Put updated info into the README file. Made a few corrections (hope you like).
AndyOpie150 said:
Put updated info into the README file. Made a few corrections (hope you like).
Click to expand...
Click to collapse
pushed your changed to github all code changes are welcome even forking the repo on github and making changes and doing pull request are welcome
raziel23x said:
pushed your changed to github all code changes are welcome even forking the repo on github and making changes and doing pull request are welcome
Click to expand...
Click to collapse
Just uploaded changed attachment. Fixed minor typos in Installation Instructions. Sorry I didn't get it straight before you pushed to github.
I deleted the info for Windows in previous attachments as well due to this being for the Linux version. Didn't know if you caught that.
PS: Thought I would let you decide if you liked my hair brained ideas first.
Is there any way to have a .jar file work without having to rename to .apk, or is that a mind bogling code rewrite. I'm all for learning.
Hey, I made some changes to the script to act more like the windows version of this tool. I added a setup.sh which will create all the folders and set permissions to everything. i also the ability to have multiple projects going at the same time, and also added a separate jar/dex folder so there is no need to rename the jar files to .apk to edit it. and other updates as well. its not 100% up to par with the windows one, but these few changes make a huge difference. Would you be interested in this?
---------- Post added at 11:38 AM ---------- Previous post was at 11:36 AM ----------
AndyOpie150 said:
Just uploaded changed attachment. Fixed minor typos in Installation Instructions. Sorry I didn't get it straight before you pushed to github.
I deleted the info for Windows in previous attachments as well due to this being for the Linux version. Didn't know if you caught that.
PS: Thought I would let you decide if you liked my hair brained ideas first.
Is there any way to have a .jar file work without having to rename to .apk, or is that a mind bogling code rewrite. I'm all for learning.
Click to expand...
Click to collapse
actually yes there is..i made an updated version of the script which has those features
clmowers said:
Hey, I made some changes to the script to act more like the windows version of this tool. I added a setup.sh which will create all the folders and set permissions to everything. i also the ability to have multiple projects going at the same time, and also added a separate jar/dex folder so there is no need to rename the jar files to .apk to edit it. and other updates as well. its not 100% up to par with the windows one, but these few changes make a huge difference. Would you be interested in this?
---------- Post added at 11:38 AM ---------- Previous post was at 11:36 AM ----------
actually yes there is..i made an updated version of the script which has those features
Click to expand...
Click to collapse
Make a pull request on github and in will merge it
Sent from my Xoom using Tapatalk HD

Completely stuck trying to import SwipeListView library into project

I've spent about 3 days now trying to figure out a way to put a SwipeListView onto an Activity. Here's everything I've tried.
First, I downloaded SwipeListView from Github here: github.com/47deg/android-swipelistview
then I went straight to the tutorial in the Issues section here: github.com/47deg/android-swipelistview/issues/17
Unfortunately, There were still errors after I had followed the directions.
"R cannot be resolved to a variable" was in my SwipeListView.java file, as well as my PackageAdapter.java file. I don't know how to clear those up. These errors are associated with layout/ files, however after putting the layout files in both the SwipeListView project and my project, neither seemed to resolve the error.
Next I tried installing it as a Maven Dependency, by following the directions here: rgladwell.github.io/m2e-android/
However, after doing so, I did not see as the screenshot suggested a 'MAVEN DEPENDENCIES' folder in my project hierarchy. I am even more confused with Maven than I was trying to install the library on my own.
I really don't know what else to do at this point. Any help is appreciated!!
Copy the sources of the library to your src folder
Resources of the library to your res folder
Create a file named R.java in the library package and extend the R.java of your project
Done
Sent from my GT-S5302 using Tapatalk 2

Help with apktool

I am having an interesting time with apktool. Much of the problem is due to ignorance on my part and I've done some reading and searching but it's still opaque to me. Just to be sure I was even close to getting a result I did the following:
1. Installed a copy of the framework-res.apk from my NST ("1.apk")
2. Decompiled the apk I'm working on ("Books_1.5.2")
3. Recompiled the same app, without changes
Almost immediately I get a string of errors as shown in the attached image. They don't mean a lot to me, but I have suspicions that I don't have the minimum requirements of JRE or JDK or something of the sort on my machine. I don't want to go the whole SDK route if I can avoid it. I just want to play around a little.
I've tried several versions of apktool and always get a similar result. Can someone help?
Um, you don't copy the framework to 1.apk, you make it.
Code:
apktool if [i]myframeworkres.apk[/i]
Errors out of apktool are difficult.
Maybe it really just can't find aapt.exe, Android Asset Packaging Tool.
It should be in myandroidsdkdir\build-tools\version\aapt.exe
Renate NST said:
Um, you don't copy the framework to 1.apk, you make it.
Code:
apktool if [i]myframeworkres.apk[/i]
Errors out of apktool are difficult.
Maybe it really just can't find aapt.exe, Android Asset Packaging Tool.
It should be in myandroidsdkdir\build-tools\version\aapt.exe
Click to expand...
Click to collapse
Thanks. My bad with the framework. That is what I did but it also turned out to be the problem. I saw a suggestion somewhere to skip that step and when I did everything worked fine!
Always something...

Categories

Resources