Completely stuck trying to import SwipeListView library into project - Java for Android App Development

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

Related

Rename an apk so you can install it twice

I've been looking for a way to do this for the past couple days with no luck. Just to get any suspicions out of the way, I am not using this to steal someone else's work, it's for a workaround for a game that I'm trying to accomplish using two save files. I've tried going into the android manifest, editing the package name, and then resigning the apk with no luck (i just get parsing errors when I try to install). Is there any way that this can be done? or am I missing something?
It is not a simple matter.
APKs are managed by package name, not by file name, but you can't simply change the package name in the manifest of a compiled APK.
Even assuming you manage to do it without messing up the file, which is not a simple task, there will still be code referring to the package name, so the app will crash.
To put it simply, you would be better off getting your device rooted (if you don't already have root) and playing with the application data files if you want to cheat at some game.

Gen folder empty

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)

How to Edit XML Files on Your Device (AIDE/Axel)

Here is a method for editing xml files directly on from your phone (as well as a fully functional Eclipse compatible IDE). I'm going to sleep so I'll post a reply I made in another thread first, and clean up in the morning. Have fun..G'night!
-------------------------------------------------------------------------------------------
Quote:
Originally Posted by Toni5830
You can extract xml but you can't see them (only strange symbols) and you can't edit them from phone.. you must use PC and decompile them.. no other possibility
Inviato con Tapatalk 2 dal telefono di casa
-------------------------------------------------------------------------------------------
No, you can edit them on your phone. Axel is one of the apps to use. The second is an IDE called AIDE which is compatible with Eclipse. You can develop, program and publish complete apps from your phone. I figured out how to edit compiled xml the other day. Ninjamorph is also useful because it unpacks the archives into a project which happens to be near where your AIDE projects are.
Begin by opening ninjamorph and choosing the apk to work on and create a project (can do this manually but keep a back up of the apk). Next, open AIDE and create a new project. As an example I'll be editing the lg_allapps_button_text.xml file in LGHome.apk (LG's launcher on G2, so files may differ for you). Choose the HelloWorld setup as that's the less,cluttered one. After creating the project, open up a file manager (you can do this from within AIDE as well) and create the same directory structure for your xml file (probably doesn't matter if a ../res/color xml file is in ../main..but it's good practice. The xml I'm editing is in /res/color, so I'll go into the project directory and create a ../res/color folder.
Now open Axel up and find the xml in the ninjamorph project that you are editing. Again in my case it'll be in /res/color. Go ahead and open it with Axel. Don't bother editing it here, we're going to just go into settings and "save as" (into our AIDE project directory) ../res/color/lg_allapps_button_text.xml. This adds it into our AIDE project and we can now go back into AIDE. In the oberflow action, choose "Goto Files" or whatever it's named (also an icon at the top for this action). It'll open a pane at the bottom with your project files. At this time you'll probably notice AIDE throwing a lot of errors (errors in your code, not app errors lol).
We have to fix every one of them before finish, so might as well start now before editing. Conversely, you could do this in Axel first once you know what kind of errors to expect and fix. In my case, I see two errors because the file is really small. Once clicking on the xml I want to edit in the files pane, I can see that it's telling me string values aren't allowed in the "color' attribute. The color is black but when Axel decompiled it, it changed it from it's ARGB form. I see this -
Code:
#xml namespace blah blah...
.....
....... android:color="1F000008/0xFF000000"
Of course there is more, I just highlighted the attribute I need to fix. You're going to need to learn how attributes need to be formatted or learn and keep a reference handy. Google has nice guides online for building android apps. In this case we change it to:
Code:
...
.... android:color="#FF000000"
Technically yes it's still a string, and yes the wrong format was hexadecimal (sort of), but now we have one less error. On large xmls, this gets annoying but you'll get fast at it. So, I've fixed,myerrors, so now for simplicity I'll just change the color on one of the attributes..to red ("#FFFF0000"). Now that edits are done and errors done, go back in the ooverflow action and scro,down and either click "Run" or "More" and then "Rebuild Project". We aren't worried about any other file, we just want our xml recompiled. Once it's done, if you want you can install your fancy Hello World app (or Tetris game app), lol but it's just as well if you choose not to.
Next, go back into your file manager and find your way back into your AIDE project directory. Locate the bin folder (where your compiled project will be) and navigate to your xml. Again, in my case, I'll be going to /res/color. Make sure you find the compiled version (the binary one with all the cool symbols). Copy this back into the same structure inside the ninjamorph project folder. If you aren't using ninjamorph and manually doing this then make sure you have a backup apk handy and akip the ninjamorph stuff.
Opem Ninjamorph back up and choose to complete your project. Once it's done repackaging it'll ask you if you want to resign the apk
Follow Steven's directions and dont sign it if its a system apk. Next he'll ask about zipaligning (i think?). I don't choose this option at all. If my mods work, then I'll redo the project and choose that option. Problem is, sometimes it can cause issues and you don't want to add more variables in until you know that all,is working or you'll be asking yourself "wonder if my edits were bad,or the zipalignment".
Ninjamorph will create a backup of the apk for you, and now you'll be given the option of installing the apk. You should know what you're doing already but...if using TWRP you can go ahead and replace the modded apk and reboot. Worst that'll happen is boot loops or force closes and you can manually go into recovery and use TWRP's file manager to copy your backup back (may need to mount /system first, and may need to chmod as well. Then try again. If you boot up and all is well, congrats! If using CWM, make sure you have a recovery plan before making the switch.
I have no clue if,there's any easier way. I'm still working on it. Granted, kf you're just going to edit a color like in my example it'd be MUCH easier just using a hex editor. AIDE is a pretty damn slick app as it also supports native mode C/C++ for developing codecs, drivers,,etc. For $8 you can purchase full version with support for larger projects and github and a few other things.
This method should work on any device that can run all those apps. I'm using a LG G2. I'm not the,developer of any of tbose apps so don't come to me if they aren't working: )
Reserved
MidnightHarvester said:
Reserved
Click to expand...
Click to collapse
Thanks sir really appreciated your work
Also please continue to post apk editing posts

[Q] [Help] Need help about decompiling apk's

Well, I was developing a little game, some days ago I formatted my pc and forgot to make a backup of my projects, fortunately I have .apk file in my dropbox account, so I tried to decompile using APKtoJava and browser decompiler.
I got res files, every XML file it's ok but, the src part is not fine at all.
Most of .java files can't compile, those files have errors, and reading the code I found variable names changed, strange code lines added, etc.
I could fix lines but last time modified files was on august (stopped development due to exams, etc), so I don't remember too much what I have done, in fact, expected to remember what I did reading code, but with those modified lines can't expect to remember fine.
I ask you for help, is there another way to get the code exactly I have made? or at least with no errors?
Thanks.
Well this happened to me too once, fortunately it was just a learning project for me, nothing important. But still I can understand how you feel. Try this -
Try decompiling from apk to java without selecting the smali code option. If you select smali code the whole code generally messes up. Also do not select the Convert to Eclipse Project option (although it could work in your case, never worked well for me). This way you will at least get your source files. Then use Virtuous Ten Studio, it will decompile everything perfectly except for source files. And then try to put them back together piece by piece, although it's easier said than done.
Good Luck with it :thumbup:
Sent from my Galaxy Nexus using Tapatalk

Can't decompile SecSettings ApkTool

Hi
I try to decompile SecSettings by apktool and i get this:
Code:
C:\apktool>apktool d secsettings.apk SecSettings23
I: Baksmaling...
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources:
spec=0x7f020052 drawable/avatar_default_6, config=-hdpi
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:196)
at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:165
)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:130)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:10
5)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibRes
ources.java:315)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.jav
a:50)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.jav
a:43)
at brut.androlib.Androlib.getResTable(Androlib.java:44)
at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:148)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at brut.apktool.Main.cmdDecode(Main.java:128)
at brut.apktool.Main.main(Main.java:65)
What to do ??
Thanks
Please any help?
Same issue here
osherdadon said:
Please any help?
Click to expand...
Click to collapse
Using a Note 3 from T-Mobile, I pulled the file with the adb command, with root explorer, and extracted it from the stock ROM file all giving me the same error. For some reason I also don't get any smali files out of my SystemUI.apk which has been driving me crazy. I can't seem to find any working answers yet... Fail...
Basically bumping this thread a half a year later...
SOMEONE HELP US
You have the relevant frameworks installed and java in your path?
Learned a lot in 24 hours
DSA said:
You have the relevant frameworks installed and java in your path?
Click to expand...
Click to collapse
Summary/Lessons Learned in the last 24 hours:
I must have been too tired, went to sleep got up again and went at it. I realized a few things, main thing was deodexing, I learned all about that. Converting the .odex file to a class.dex file inside the SystemUI.apk and SecSettings.apk so decompiling would work properly (I was originally missing the smali folder without deodexing my app). Second I needed to pull all the framework files from my device instead of just the two I had, then I used "apktool if framework-res.apk" then "apktool if twframework-res.apk" then "apktool d SystemUI.apk" then "apktool d SecSettings.apk". This time it actually worked, I proceeded to try and re-compile them just to test. The SystemUI.apk worked flawlessly but the the SecSettings.apk had errors then I realized I needed to copy the AndroidManifest.xml and resources.arsc from the original app to the decompiled folder and the SecSettings.apk compiled with no issues. I had to get the original file out of the stock ROM, it had gotten damaged somehow with zipping/raring/7zipping so quicktip no one should be zipping the files you're about to work on get it fresh from the ROM.
Current Issue:
Now that all that's done I'm onto what I was trying to get at when I started this whole project. I need to modify both of these apps which are now perfectly deodexed and on my stock device. Every time I try to modify these files I lose my status bar and my settings stop working, I'm obviously breaking it, this is the XDA guide I was following.
Any help or redirection on where to post would be greatly appreciated, thanks
Easiest thing - put your mod back in and get the status bar to disappear/fc whatever
Then, pull a log (catalog from appstore works fine)
Post that log at pastebin and link it here
We won't be able to solve your issue without knowing what it is, in the first place
Like this?
This was before I restarted: Log 1
Then I recorded for a little after I restarted probably pointless but that's where the error would have been: Log 2
DSA said:
Easiest thing - put your mod back in and get the status bar to disappear/fc whatever
Then, pull a log (catalog from appstore works fine)
Post that log at pastebin and link it here
We won't be able to solve your issue without knowing what it is, in the first place
Click to expand...
Click to collapse
Not sure exactly how to record it and send it to you, I pressed record but when the phone finished rebooting CatLog was closed so I reopened it and it keeps scrolling endlessly.
Research progressed a little
I came across a post here in the Flashlight Mod development thread which made me realize I'm not getting the ID's correct. They suggest compiling the modded SystemUI.apk to get the ID's into the apk file under the /res/values/public.xml file, then decompiling it to read the ID values. I'm missing a step or doing something wrong, I can't replicate it to find the ID values I need so I can add them to the .smali file and recompile a final time. I'm sure this is the only reason for the missing status bar and the force closes. I guess I need help understanding, a different set of instructions or just more detailed?
I can't post in that thread yet so I'm getting my posts up over here, I already posted in the Q&A thread but no one has responded yet, any help is greatly appreciated!
I get this when decompiling the modded apk: Modded SystemUI ApkTool Decompile
All these errors look like the file is broken now or something, I'm just lost at this point. I tried ApkTool 1.5.2 and 2.0 as well.
EDIT:
Additional info below for troubleshooting purposes since it seems my issue recompiling at the end to get the values for my public.xml
STEPS:
1. deodex (universal deodexer v5)
2. decompile (apktool 1.5.2 & 2.0 separate tests)
3. modify (add flashlight .png's and .smali file from 4.4kk flashlight mod files)
4. recompile (apktool)
5. decompile (apktool)
=
Errors <<<<< These errors solved in edit below
EDIT:
I forgot to use "apktool if SystemUI.apk" when loading "framework-res.apk" & "twframework-res.apk" now I get through decompiling and recompiling like I thought I should be and I even located the values int he public.xml, replaced them in the .smali and everything went peachy. Only problem is I never get the status bar after I reboot, not really getting any FC's but the status bar, if my goal were to get it to be invisible I would be so happy omg lol If you're curious I've also tested by signing and even another test with zipalign, nothing zip/zero/zilch...
EDIT... Again I know still no sleep, durp durp:
So my main issue was not using apktool v1.5.2 to decompile and v2.0 to compile EVERY SINGLE TIME, NO EXCEPTIONS. When I followed that simple rule I get it onto my device and she has no status bar... Hmmmmm..... And a logcat for anyone smart enough to help me
EDIT:
Maybe I'm in the right direction with an error I saw in the log at this post? I thought it was so I installed the DisableSignatureVerification Mod from the Xposed Modules and still nothing.
Calling All Developers
It's been like 2 weeks just curious if anyone has even looked at this, I haven't been able to make any progress so I started learning how to develop apps. I made two small apps basic flashlight and a counter app but I really want to know why I'm totally unable to mod a file on my phone. I can't get the ink effect to work with finger input either I've been really trying to get this flashlight mod and the ink effect for months. If I could get pointed in the direction of a developer that can actually help me I don't see why I couldn't donate like $10 or $20 to the one who helps me. I'm on android 4.4.2 (NK3) on my Note 3 from T-Mobile.

Categories

Resources