So I am trying to publish an Android app to the store, and I get the error message to remove all debugging from the app. Well I started to do research and the only thing I can find are post from nearly 4 years ago and people saying to use ProGuard. Well I am not exactly a Android Developer, and I don't really know any Java. I am using Android Studio to create a simple WebView application for my website. So what files and exact code do I add/remove to so I can get this published. I have added the below code the AndroidManifest.xml to the activity:
android:debuggable="false"
What else? I don't know exactly where to put the code I have seen in past StackOverflow questions. Is ProGuard now integrated into Android? I'm so confused.
EDIT** I have made sure that there are zero calls to Log, and there are no startMethodTracing() and stopMethodTracing() in my code. I am simply following the guide on how to create a simple webview app. I have created only one class myself. Also I cannot find the project.properties file in Android studio.
A few things to try:
If there are any calls to stopMethodTracing() or startMethodTracing(), make sure you remove them.
Make sure android:debuggable="false" (as you have done)
Remove or comment any references to android.util.Log such as Log.d() or Log.i()
Export your app as a signed application package, using your developer key. This automatically runs zipalign and cleans up any unnecessary resources.
(Optional) Modify your project.properties file to and uncomment the proguard.config line. This should point to a proguard.cfg file that was probably generated automatically when you created the project. Proguard will obfuscate and minimize your code.
Related
How do I combine a standalone Java application with an Android application?
I have a piece of code taken from the Google quick start examples that perform a task that I can't seem to be able to combine with my activity source code.
I'm of course talking about the following Google example: Sheet API, if I just add it as a standalone class and tell Android Studio to run this application, before my Android application, then it will produce what the code is suppose to do.
If I try to copy and paste the exact code into one of my activities it will give a couple of problems. One is that it can not find my keystore, another is a threading issue which I understand, another being that it can not find the credentials (even if the file is present), the newTrustedTransport-method call will be an issue, the setDataStoreFactory-method call will be an issue, file creation even with the correct uses-permissions and so on.
What is going on in the background that would make exactly the same source code work in one instance and not the other? What do I not know about Android Studio, and how an Android project works in the background for me having these issues?
I had an idea that I could just keep this standalone application as it is and store a file with the result that this Sheet example would provide me. But, since I do not have enough experience with Android Studio I have no idea if the result will be available for the actual Android application once it was made into a release. Will it? I can't save the output file generated by the Sheet example, under the res-folder, under the app module for some reason (scope?).
With other words... Can I have a standalone application, that is tasked to run before the Android application, to gather data and it will be doing this EACH time the Android application is run on a client? I feel like it would be stupid if the IDE would present this like this would actually work but then when the application is made into a release then the standalone application will not "follow" and be part of the release...
If I could just combine the source codes, I will not be having this issue at all. No examples online, neither Github or Youtube can provide me with answers on how to do this. Many examples online provide me with source code that is either out of date or just not what I'm looking for, and I really hate Google's way of explaining things. Just look at how they give code examples under this page: Google API Client Library for Java, and not give a full example where they would fit into the a project. Maybe all I need to make everything work is to use the code under "The library runs on Android 4.0 or higher (#Beta)."
When I do any changes in xml layout file, it doesn't reflect with new compilation build although R.java is generated but when I run the application changes doesn't reflect. I need to rebuild the whole project which is taking time. Any help on this?
I guess before it was working fine.
Yes Sometimes it also happens to me. If you are doing changes i right way in the Xml file then those must be appear when you run your app. But if it does not happen, then you need to rebult your application, or clean it several time. if it also does not work to you then do the follwoing :
Close and re-open (Restart) the android studio and try running app again.
If step 1 is also not helpful then Uninstall app from your device , Disconnect and connect device again and rebuilt/Run app directly in your device again.
I hope this will work for you.
Pleas check if you have enabled Power save mode (File -> Power Save Mode) which turn off auto compilation
Android Studio - Auto complete and other features not working
I "touch" AndroidManifest.xml and that forces a build. Does not take nearly as long as rebuilding project or restarting emulator. It's a hack, but hey, it's my hack.
This sounds similar to my situation. I had an extra quote character in my colors.xml file, which caused errors when I tried to run my app. What worked for me was to remove the extra quote in my colors.xml file. Then I saved the file. Then I restarted Android Studio.
You can simply switch to project view and remove the build of the app:
After a few days of fighting this issue, I solved it by deleting all "v26" directories inside the "res" directory, since the activity was using it instead of the usual "layout" directory for accessing the xml.
app/src/main/res/layout-v26/
had to be deleted and you should remain only with
app/src/main/res/layout/
Anyway, I am new to android development and am not sure if this can lead to other issues, so be careful.
Details: I have reinstalled eclipse 3 times, updated it & the ADT and DDMS, too.
I have found out that when I create a new android project the scr file is nearly empty. In each Activity there is only one java file and the rest is missing. I have attached a screenshot from the Maste/Detail flow activity so that you see where the problem is.
If you can help me please leave a response.
This is not a bug - it might generate additional files
depending on what starting activity you choose e.g. login activity it requires additional logic for working with Google+, however most will contain all the logic for a specific activity in a single source file, the source code included in the source files will often be minimal to make sure the activity works without the developer having to manually implement things they might otherwise not know about e.g. the fragment activity.
You might want to try out android studio instead if you are not dependent on eclipse as android seems to be moving towards using it and gradle.
(I do use android studios and am currently working on android apps and even though it's in beta it has not given me any problems)
This is a reported bug. Refer to https://code.google.com/p/android/issues/detail?id=72571
To solve the problem, look for ftl files in the tools\templates\activities subfolder of the SDK. In the files found, change <#if appCompat> to <#if appCompat?has_content>, and ${appCompat?string('Fragment','')} to ${(appCompat?has_content)?string('Fragment','')}.
I am working on an android project and wanted to integrate FB into it.
Using the FB SDK tutorial, I imported the FB SDK into my workspace along with a sample project. The sample project seems to have no problem with the FB library. But when I try to go to stick the library into my app, my app refuses to generate R.java. If I remove it, the R.java gets generated again.
I did a lot of googling and tried the common tricks like cleaning my project, checking for XML errors, etc.
I am now thinking it might be a problem with having both Facebook and Parse. Parse used to have Facebook SDK integrated, but they changed that recently and they now want you to import the Facebook SDK. I tried both not updating and updating Parse, but either way still not generating R.java.
I have set it so my min SDK is level 8 and the max is level 17. I tried raising and lowering the max, but it made no difference.
I have been working on this for the whole day but cannot figure out what is going on. Anyone having similar issues or have insight into the problem, I would very much appreciate feedback.
Edit: I do get this on the console: WARNING: unable to write jarlist cache file /Users/.../facebook-android-sdk-3.6.0/facebook/bin/jarlist.cache
Edit 2: I think I figured out the reason: http://www.reddit.com/r/androiddev/comments/1xajcp/too_many_methods_for_dalvik_help/
I have done this with iOS perfectly and now I need it for Android. I have one codebase that can create unlimited different apps with a simple config file change.
Each app is created based on a complex XML config file that I included in the resources. All I make is one simple change in my strings.xml file and it points to the config file needed, which in turn makes this my project a new standalone app. Easy.
<string name="xmlconfig">nike-shoes</string>
But now that I have done that, how do I make the change so each app is it's own APK?
How can I switch between apps (and uploadable apk's) easily with one codebase and one project. I have heard people say "use a library and then just create a project for each that includes it" but that gets overly complicated when you have 15+ apps and growing.
And I've also seen people say "why not just make one app where you can switch between them all within the app" but that also is irrelevant to my project and doesn't make sense to my users. I can't explain more than that unfortunately, but the short answer is that this won't work as well.
What I did on the iOS project I have is that I just change the Bundle ID, change the code signing identify to match, change the app name, and point to the new plist from within my main Info.plist file. BAM! Whole new app. A few simple steps that takes me less than a minute.
How can I do this with Eclipse/Java/Android? What is the easiest way?
A few steps is fine, as long as I am not mucking with every file to get it done.
I figured I would answer my own question here using Android Studio (2.2.3 at the time I'm typing this), do the following:
In your AndroidManifest file, click on your package name (click the whatever part of com.myapp.whatever) and then hit Shift+F6. Choose "Rename package" and then rename it (without the com.myapp part). Don't do it for comments, strings, and text unless needed. You'll need to approve the refactor with the button at the bottom of the Android Studio window.
Check your build.gradle file and make sure your applicationId under defaultConfig matches what you changed it to.
In your strings.xml file, change your app_name and other strings as needed to make your app its own.
Takes me about 1-2 minutes to have a whole new app. Hopefully someone else finds this useful.
All you need to do is change the package name in the manifest(and a little re-factoring in your code file due to base package name changed), and the next build will create a new App.
If you want to maintain all your apps I would also recommend to create a branch for each app that will contain this change set. this way you can fix something and push it to all versions.
Lets say you change com.foo to com.foo.bar, then rebuild, all your R imports should be now added .bar, just find replace import com.foo.R to com.foo.bar.R, thats about it.
Convert your initial project in a library project, then reference to it from all other projects. This way you have a big advantage: all modification made to the library project are yet available in the other projects. Refernce: http://developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject