Proguard.cfg Missing - java

I made the mistake of upgrading eclipse today and now can't get my a new Android project to get going.
I get the message Proguard.cfg (the file can't be found).
Where is this thing I can't seem to find it? Is it possible to get rid of it I don't need Obfuscation in this project...
Thanks

lately the base proguard config is here in the sdk dir - so you only have to put this into your project.properties:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt
if you want to make project-specific modifications, create a proguard-project.txt and change the line to:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

If you really don't need Proguard to obfuscate your release builds, you can remove the following line from the default.properties file in your project root folder:
proguard.config=proguard.cfg
If you want a proguard.cfg template, you can create a new Android project from scratch with Eclipse's project wizard, then copy proguard.cfg from the new project over to the previous one.

I just experienced the same problem.
You need to update your SDK tools to current version.
In Eclipse go into your Android SDK and AVD Manager.
Select Installed Packages in the left hand tab.
Click Update All.
Select the SDK tools latest version.
Click Install.
After it's done you should have the Proguard.cfg file in your tools/lib/ directory.

cp /android-sdk/tools/proguard/examples/android.pro /android-sdk/tools/lib/proguard.cfg

Related

IntelliJ : Cannot resolve method 'run(java.lang.Class, String[])'

I've encountered a problem where on all of my applications, there's a red cross on the top right. I can run it, but the cross doesn't seem to go away.
I've opened the run/debug configurations and it says Warning : Main method not found. I don't understand why it's not found when I already have a corresponding main class and method for each and every application.
I tried to close the project, restarting IntelliJ, restarting my laptop, refreshing my desktop, refresh Gradle by clicking Reimport All Gradle Projects, rebuild the project and clicking Invalidate Caches / Restart. I also tried other suggestions I found on StackOverflow such as deleting the .idea folder. Nothing. The red cross still shows up. I've also realized that I do not have the out folder in all of my Applications.
I just set the language level to equal my SDK version at Project Structure. Finally, it is disappeared.
In Project Settings, First make sure SDK path is correct. Preferably install and use your own SDK. Then use the same SDK in Project and Modules in Project Settings.
File->Project structure ->SDKs
Choose JDK home path, if no jdk is in the path,
you'll see an icon download jdk
download then ok
Try to copy src and gradle folders and buil.gradle and settings,gradle files in separate folder. Then open this new folder as new project in intellij. Then intellij will propose Import as gradle project... - push it.
If problem remained see you build.gradle

Multiple dex files define Lokhttp3/ResponseBody$BomAwareReader [duplicate]

I know this question has been asked here a few times before. But i haven't seen any possible solution yet.
Before i make the project 'Run as Android Application' , if i do not clean it, i receive the following error and have to restart Eclipse ... and clean again.
Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define
Lcom/jstun/core/attribute/MessageAttributeInterface;
com.jstun.core... is a part of my src folder, of course i can't remove it. And even if i remove that package, another package will show up as an error like:
Unable to execute dex: Multiple dex files define
Landroid/support/v4/app/ActivityCompatHoneycomb;
I've seen this error since updating to ADT 15, i'm using Eclipse Galileo on Ubuntu
Do you have any idea? Thanks for any reply!
This is a build path issue.
Make sure your bin folder is not included in your build path.
Right click on your project -> go to properties -> Build Path.
Make sure that Honeycomb library is in your libs/ folder and not in your source folder.
Include the libraries in libs/ individually in the build path.
BTW, you may want to bring in the android-support-v4 library to get Ice Cream Sandwich support instead of the Honeycomb support library.
I have encountered a similar error today and the reason was that the support library was referenced by two library projects used by my app project but with different versions.
In more details:
My app depends on 2 library projects
FaceBookSDK 3.0 -> which is referencing android-support-v4
ActionBarSherlock -> which is referencing android-support-v4 but with a modified version to support maps.
To solve the problem I had to make FaceBookSDK library depend on ABS library instead of the support library directly.
Well for me, I deleted the file in the libs folder called android support v4.jar and it all worked out. Goodluck :)
I had the same error happening and every time I fixed it, it would come back after I restarted Eclipse.
First of all, as other people said, make sure you do not have multiple copies of the same .jar file around your projects.
In my case, I had a main project that used ActionBarSherlock (among other library projects). The trick that worked for me was going into ActionBarSherlock --> Properties --> Java Build path --> Order of Export and unselecting Android Private Libraries. Then going into Project -> Clean and now you should be able to build the project correctly.
Now, for some reason, every time I restart Eclipse, it automatically enables that checkbox, so I have to repeat this process again.
Hope this helps some lost soul out there :)
Go to Project/properties and Java Built Path and unchecked the Android Private Libraries
To me, just go to Project Properties >> Java Build Path >> Order and Export. Uncheck all external library, as the image bellow. It work for me. Hope this help.
I have also faced this problem in my project. AVD is not able to reload assets,lib,res and etc folder contexts.
problem :
Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.
Then,I created new projects and copied MainActivity.java,activity_main.xml, drawable context.
Then delete old project from package explore,restart your Eclipse and AVD.
My project is now working properly.... :)
I hope this steps will help u little bit folks..!!
I have same issue, what i tried is:
List item
Open Project Build Path,
Select "Libraries" tab,
Remove all library except the Android Library
Adding all required JARs Files,
And Done!
It works for me, thanks.
If some of you facing this problem with facebook-connent-plugin for phonegap
try to remove files in bin/class/com/facebook/android directory ! -> and rebuild
As others mentioned, this occurs when you have multiple copies of the same class in your build path, or elsewhere in your setup.
I had added android-support-v4.jar to my libs/ folder, and somehow eclipse added a second copy to bin/classes/android-support-v4.jar.
You can test for this with
grep -r YourOffendingClassName YourApp | grep jar
Deleting the extra copy in bin/classes solved the problem - unsure why Eclipse made a copy there.
I got this error for another reason. I was mistaking adding both the v4 AND the v13 support library. This was not necessary for me since my minSdkVersion is 15.
I fixed it by only including the v13 support library. Also, make sure to check mark the library in your exported library build path in eclipse. I also moved it to the top.
Even after going through multiple answers, no solution worked for me.
I deleted "Android Dependencies" from the build path.
Added all the jar files again to the build path and the error was gone.
Somehow eclipse seemed to cache the things.
I'm leaving this answer for someone who gets in this scenario as I did.
I stumbled here and there before noticing that I mistakenly dragged and dropped the Support Library JAR file into my src folder and it was lying there. Since I had no idea how it happened or when I dropped it there, I could never imagine something was wrong there.
I was getting the same error, I found the problem after sometime and removed it. Project is now working fine.
The Solution for me was just to do following things:
->lib directory in your project and delete any multiple elements.
Project->Properties->Java build Path and delete any Dependency Library was added automatically and not by you! ->Apply
Restart Eclipse IDE
Now Clean the project.
Run/Debug on Device/Emulator the project ...
Good Luck
My problem at first was:
Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
1) I Right click on my project -> Android Tools -> Add Support Library
(Run my app...Didn't work so I keep it going...)
2) Right click on my project again -> Properties -> Android -> Check Android 4.1.2 (16) on Project Build Target
(Run the app again...and get this:
Unable to execute dex: Multiple dex files define Landroid/support/v4/app/BackStackState;
3) So I went to the "lib" folder on my project and delete the "old" Android.support.library.jar
(Run the app and cross fingers and...)
¡IT WORKS!
Hope it helps someone...Thanks people!
I have had this issue and that doesn't mean, that the same library is loaded many times but System is trying to load a class with the same name and possibly same package name simultaneously, i.e.
com.pack1.de and Class Geometry of library1.jar
and another
com.pack1.de and Class Geometry of library2.jar.
How should you approach?
You should analyze which methods are being used, a method of library1.jar or library2.
There are 2 Solutions,
Rename a packagename and then dalvik interprets, that they are distinct classes
Or if you want to risk, purge the class, which doesn't contain the methode, which we really use.
I hope that has clarified this often asked question.
I removed Android dependencies from build path and it worked.
This error happened to me when in my app's project I referenced a Library project in my Eclipse workspace (in my case the Facebook SDK) and at the same time included the Facebook SDK as a jar in the libs folder. Removing the library reference but keeping the jar in the libs folder removed the error.
I had same problem. I had to delete the .apk file and then it worked.
For me I deleted android-support-v4.jar from lib folder and also removed from build path.
Right click on project and go to build Path>configuration build path
Select library tab and click on support-v4 library and click on remove
Click on OK
and then clean your project and run it will work :-)
In case anyone else bangs their head on this issue like I just did:
My case involved a chain of library projects. Simply doing a project clean on all of the libraries fixed everything
I found below solution in eclipse...hope it works for you :)
Right click on the Project Name
Select Java Build Path, go to the tab Order and Export
Unchecked your .jar library's
This problem occurs when a same library is added into your project multiple times. If you haven't added the library multiple times intentionaly, check out the dependency/private libraries of the libraries you have added in your project, most probably they have already included a library which is causing this conflict.
I was also struggling to find this is issue. In my case what happened is while copying the apk to email (drag drop) - by mistake the apk was pasted in src folder in one of the packages.
After removing the apk from source folder it worked fine.
I had this problem in Intellij and it was because the ActionBarSherlock library I added to my project defined the android-support-v4.jar as a compile dependency and this jar was already included in my project so there were multiple copies/version of DEX at compile time.
The solution was to change the ActionBarSherlock module dependency for this jar to be Runtime instead of compile, as my project was already providing it.
For me the issue was that, i had added a lib project(autobahn lib) earlier and later switched the to Jar file of the same library.Though i had removed references to the older library project, i was getting this error.
Following all the answers here i checked the build path etc. But i haven't added these libs to build path manually. So i had nothing to remove.
Finally came across this folder.
bin/dexedLibs
I noticed that there were two jar files with the same name corresponding to autobahn Android which was causing the conflict. So i deleted all the jar files in the dexedLibs folder and rebuild the project. That resolved the issue.
To add the myriad of other potential sources... I had updated all the libraries in my project's lib folder but then Eclipse "helpfully" reinstalled all the original libraries. There was no longer any reference inside Eclipse to these libraries but the external dex-maker program just grabbed all the files in the lib directory and thus got two versions of several library .jar files.
git status identified the new files and git clean -f got rid of them for me (though I sometimes had to wait or restart Eclipse on Windows because it still had the files open from the copy).
ULTRA simple solution and finest:
Remove everything in Right Click Main Project's Folder -> Properties -> Java Build Path except Android X.Y (where X.Y is the version in android). Clean, and Build. Done!
Make sure before of that to have a single android-support-v4.jar.
If you are using cordova, try cordova clean command

The import android.support cannot be resolved

I am trying to run the code provided HERE
I downloaded the code from their Github and imported into Android SDK, but it shows error at the lines
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
in multiple files. However if I check the Android SDK Manager, the Android Support Library as well as the Android Support Repository in the Extras folder are both installed. I can also see the support folder and it's contents in the SDK_INSTALL\sdk\extras\android\support directory. It also has the v4 folder which also contains the android-support-v4.jar and the src folder. THen why is it still showing the error, how do I resolve it and how do I get that sample code running? THe sample code is for an RSS reader app, if that's relevant.
Follow these steps:
For Eclipse:
Go to your Project's Properties
Navigate to the Java Build Path
Then go to the Libraries tab. There click the Add External JARs Button on the Right pane.
Select the android-support-v4.jar file, usually the path for the Jar file is :
YOUR_DRIVE\android-sdks\extras\android\support\v4\android-support-v4.jar
After adding android-support-v4.jar Library, navigate to the Order and Export tab and put check mark on the android-support-v4 Library file.
After doing the above, Clean the Project and Build it.
Problem Solved.
For Android Studio:
Short Version:
Add the following line to your build.gradle file:
implementation 'com.android.support:support-v4:YOUR_TARGET_VERSION'
Long Version:
Go to File -> Project Structure
Go to "Dependencies" Tab -> Click on the Plus sign -> Go to "Library dependency"
Select the support library "support-v4 (com.android.support:support-v4:YOUR_TARGET_VERSION)"
Navigate to your "build.gradle" inside your App Directory and double check if your desired Android Support Library has been added to your dependencies.
Rebuild your project and now everything should work.
Further reading regarding this Question:
Support Library - Android Dev
Recent Support Library Revisions
Support Library Packages
What is an Android Support Library?
How do the Android Support Libraries work?
andorid-support-v4.jar is an external jar file that you have to import into your project.
This is how you do it in Android Studio:
Go to File -> Project Structure
Go to "Dependencies" Tab -> Click on the Plus sign -> Go to "Library dependency"
Select the support library "support-v4 (com.android.support:support-v4:23.0.1)"
Now to go your "build.gradle" file in your app and make sure the android support library has been added to your dependencies. Alternatively, you could've also just typed compile 'com.android.support:support-v4:23.0.1' directly into your dependencies{} instead of doing it through the GUI.
Rebuild your project and now everything should work.
Another way to solve the issue:
If you are using the support library, you need to add the appcompat lib to the project. This link shows how to add the support lib to your project.
Assuming you have added the support lib earlier but you are getting the mentioned issue, you can follow the steps below to fix that.
Right click on the project and navigate to Build Path > Configure Build Path.
On the left side of the window, select Android. You will see something like this:
You can notice that no library is referenced at the moment. Now click on the Add button shown at the bottom-right side. You will see a pop up window as shown below.
Select the appcompat lib and press OK. (Note: The lib will be shown if you have added them as mentioned earlier). Now you will see the following window:
Press OK. That's it. The lib is now added to your project (notice the red mark) and the errors relating inclusion of support lib must be gone.
For me they were appearing when i transferred code manually to another laptop. Just do
File>Invalidate Cache/Restart
click on 'Invalidate Cache and Restart' and your are done.
I followed the instructions above by Gene in Android Studio 1.5.1 but it added this to my build.gradle file:
compile 'platforms:android:android-support-v4:23.1.1'
so I changed it to:
compile 'com.android.support:support-v4:23.1.1'
And it started working.
This issue may also occur if you have multiple versions of the same support library android-support-v4.jar. If your project is using other library projects that contain different-2 versions of the support library. To resolve the issue keep the same version of support library at each place.
I have resolved it by deleting android-support-v4.jar from my Project. Because appcompat_v7 already have a copy of it.
If you have already import appcompat_v7 but still the problem doesn't solve. then try it.
This is very easy step to import any 3rd party lib or jar file into your project
Copy android-support-v4.jar file from
your_drive\android-sdks\extras\android\support\v4\android-support-v4.jar
or copy from your existing project's bin folder.
or any third party .jar file
paste copied jar file into lib folder
right click on this jar file and then click on build Path->Add to
Build Path
even still you are getting error in your project then Clean the
Project and Build it.
Android Studio 2.2.3
Linux Mint 18.1
Inside your 'project view' open Gradle Scripts -> build.gradle(Module:app) and put your mouse pointer inside the word dependencies.
Click on the light bulb and click "add library dependency" and for me all the libraries I wanted were listed there.
example libraries that came up for me:
compile 'com.android.support:gridlayout-v7:25.1.0'
compile 'com.android.support:support-v13:25.1.0'
I am now looking to add android support by default in Gradles default configuration.

android-support-v4.jar isn't importing correctly in Eclipse

I'm trying to get an app to compile that uses the android-support-v4.jar and the Fragmentation classes it contains, but I keep getting messages whenever I try to compile that there are errors in the code. All of the errors have to do with different Fragmentation classes that are in the .JAR. I have tried ctrl-clicking the project folder and then selecting Android Tools -> Add Compatibility Library and I keep getting this error:
[2011-12-20 11:55:31 - Android Compatibility JAR not found:]
/Applications/eclipse/Eclipse.app/Contents/MacOS/v4/android-support-v4.jar
Why would it be looking for the .JAR in Eclipse's Package Contents? I've gone into the project properties and went to the Java Build Path, and imported the .JAR from the MainActivity/libs folder, that didn't work, and then I tried to import it from my SDK directory, and that didn't work. I've fixed the project properties and cleaned and built it countless times, I've restarted Eclipse, my computer, re-downloaded and installed Eclipse, the Android SDK's and ADT and still nothing. I am completely stumped.
Edit
I've gone through the build path and imported the .JAR from both the MainActivity/libs and my SDK directory. For the hell of it I added the .JAR in the directory that keeps appearing in the errors and that hasn't worked. What's making Eclipse look for it in it's Application Package Contents?
Update
So after tinkering the project contents aren't showing any errors but the MainActivity folder still says that there is one and I still can't compile.
Like nyah:
Revision
So I think the question may be "Why is Eclipse looking for the .JAR in the Eclipse Application's package contents instead of the libs directory of the project or the Android SDK directory that I used to import it as an external .JAR?"
Update #2
I am only getting one error now after tinkering, it's on this method:
#Override
public MenuItem setOnActionExpandListener(OnActionExpandListener onActionExpandListener) {
// Noop
return this;
}
The Quick Fix says that I should delete the #Override annotation but that method must override a super class method.
These are the errors that it shows:
Multiple markers at this line
- The method setOnActionExpandListener(MenuItem.OnActionExpandListener) of type SimpleMenuItem must override a superclass method
- implements android.view.MenuItem.setOnActionExpandListener
Looks like it is looking for jar here :/Applications/eclipse/Eclipse.app/Contents/MacOS/v4/android-support-v4.jar
android-support-v4.jar is found in <sdk>/extras/android/compatibility/v4
Please make sure you add this as an external jar in the java build path
I could solve this problem by
1- delete "android-support-v4.jar" from lib
2- right click on the name of the project choose "Android Tools" and "Add Support Library"
If this is still not solved:
Like already said, in Eclipse go to your Project Properties > Java Build Path > Libs > Add External and get the one from the adk directory.
Also set up Java 1.6 as your default compile version if you already haven't. This should solve the Override Errors you described.
It turns out that my Debug Certificate had expired so I just needed to delete ~/.android/debug.keystore and restart Eclipse and everything worked.
I realize that this question has been answered, but this is a known issue that is supposed to be fixed in the ADT-17 plugin release according to comment 9 here: http://code.google.com/p/android/issues/detail?id=21488
In addition, people who have this problem can copy the compatibility JAR to the location it says it can't find it. Clearly it's looking in the wrong place (since it's checking the Eclipse directory rather than the android-sdk directory), so the simple fix, for now, is simply to put the package where it wants to find it, even though it doesn't belong.
For me it was as simple as copying the v4 directory within C:/android-sdk/extras/android/support/ into the C:/eclipse/ directory.
I had the same problem running in Ubuntu. Go to Tools->Options.
Check Force https://... to http://
Open Android SDK Manager. Check Extras->Android Support Library.
Something similar happened to me. At the top of MainActivity.java I had the next imports giving errors:
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
In each of the lines on the left they had the light bulb making some suggestions. If you click on it, one of the options will be "Fix project setup". You then will be able to choose between several options for fixing the imports, you should choose the one that specifies the android-support-v4.jar.
Right click on ur project --> select android tools --> select add support library and simply installed the supporting libraries.
Do you try not to do Android Tools -> Add Compatibility Library, and only add the jar in java build path library?.
I use this jar library of this way and it works without any problem.
I had the same problem.
Under the project properties:Java Build Path:Order and Export tab, the box next to android-support-v4.jar wasn't checked. I checked the box, and the error went away.
Another caveat was running Android SDK Manager in Windows 7 without administrator privileges. It would try to install support package, but would always fail, and the actual package never got downloaded to
C:\Program Files (x86)\Android\android-sdk\extras\android\support\v4\android-support-v4.jar
Solution: Make sure that you enter the same API for "Target SDK" and "Compile with" during Android project creation (or in the Manifest file once created).

How to avoid "Refreshing external Folders" in Android development in Eclipse

I am having this annoying problem which takes 10-20 seconds and sometimes more every time my android project is refreshed or rebuilt.
I searched for android forums and also in stackoverflow and but solutions does not make sense. Please give me the solution or link to it.
My android project depends on two external java libs and android libs. Tell me if you need more info.
Earlier I asked this question and it solved the problem by removing 'source attachment'. But I believe it is not a good solution because I need source to be attached with jar. It helps while debugging, code browsing. If source is not attached then, your breakpoint stops there and you can't go in readable source.
Better Solution Needed. Is there a launcher option? which disables when app launched. or build options?
Instead of attaching a source folder to the .jar file, you should zip the source folder and attach the zipped file to the .jar.
See this answer for more info https://stackoverflow.com/a/9699242/637754
The reason for this is that you have attached source with your dependent jars. Just the remove the source from the class path. This how it can be done.
Right click on the project -> Select Build Path -> Configure Build Path.. -> Select Libraries
Select the Source attachment and Remove button will highlight. Press Remove and OK.
I think that should fix your issue.
this helped me so you can try too:
Go to your Workspace root/.metadata/.plugins/org.eclipse.jdt.core/ and remove .org.eclipse.jdt.core.external.folders folder
it contains .project file with links to external folders which takes too long to refresh
You can disable "Refresh on access" option in Window->Preferences->General->Workspace - it have no effect as I think, because even it's turned on you must manually refresh projects if you modify them outside of Eclipse
If anything else fails (my case), install a fresh copy of Eclipse Juno
Go to Help-Install Software, and add this repo:
https://dl-ssl.google.com/android/eclipse/
Check all options and install.
For migration reasons I was trying to install Eclipse on MAC OS Yosemite, since Android Studio is now the official IDE, it is hard to find Eclipse setups with the ADT plugin included. I tried several versions of Eclipse, and JUNO did the work.

Categories