dexguard obfuscation class reference not found - dexguard

on dexguard obfuscation the referenced classes not find error is thrown during dexguard release build.
can't find referenced class com.sun.jna.ptr.IntByReference
please suggest the solution.

DexGuard prints out warnings about missing dependencies, just like a compiler.
If your application relies on the class, you need to make sure that the corresponding library is listed in your project's dependencies.
If your application doesn't really need the class, you can suppress the warning with
-dontwarn com.sun.jna.ptr.IntByReference
in your DexGuard configuration.

Related

Error:(30, 0): Could not find method classpath() for arguments [com.android.tools.build:gradle:3.0.0-alpha9]

I'm new to android, currently encountering a seemingly endless supply of random errors while going through tutorials.
Currently, I'm trying to figure out how to set up dependencies. I'm not sure what my dependencies should look like and whether they should be different for different projects, but when I try to import:
classpath 'com.android.tools.build:gradle:3.0.0-alpha9'
I am getting the Error:(30, 0): Could not find method classpath() for arguments [com.android.tools.build:gradle:3.0.0-alpha9] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler message.
Screenshot of the error
How do I set up dependencies for simple projects? Is there a popular, up-to-date source to sort these kinds of issues out?
Thank you for your time.
'com.android.tools.build:gradle:3.0.0-alpha9'is a project dependency, not an module dependency, so you are placing it wrong.
Check your build.gradle project configuration at your project root directory. If there is a 'com.android.tools.build:gradle:3.0.0-alpha9' there as dependency that's all you need.

Why would a linker try to link to a file I never told it to link to?

I'm getting a linker error indicating that the linker was unable to open a file (a static library) and therefore it fails. I am having a very difficult time troubleshooting this error because I never told the linker to link to the file which it is failing to open.
I am telling the linker to link to several static libraries. Many of the libraries I am linking to are wxWidgets static libraries. I don't need ALL of the modules from wxWidgets, so there are some which I am linking to and many which I am not. The file which the linker can't open is 'wxbase31ud_net.lib'. Like I said, that file is not among the libraries I am linking to. My immediate thought was that this dependency was being introduced implicitly somehow, perhaps by one of the wxwidgets libraries I WAS linking to. I didn't think static linkage worked this way but I didn't have any other ideas. I have been investigating that possibility and I've found nothing which indicates that is the case.
I set the build output verbosity to maximum, and the 'wxbase31ud_net.lib' is never mentioned anywhere until the error is reported.
I confirmed in my cmake project that the file in question was never passed back to me from the FindWxWidgets module, and was never referenced in any of the lists of files I associate with the target.
I grepped through the entire project directory and found no reference to the file anywhere, including the cmake-generated project files (visual studio project files).
What could be causing the linker to try and open this file?
Edit: Also, to be clear, the error I'm seeing is LNK1104
it's probably from a #pragma comment(lib,"???") except in the case of wx the argument to the pragma may be complex macros and it will be difficult to grep. This particular one may be from setup.h with #pragma comment(lib, wxWX_LIB_NAME("base", "")). You should be solving this by adding the directory with the wx libs to the linker's search directories.
The answer by zeromus is correct, this is almost certainly indeed due to including msvc/wx/setup.h which contains #pragma comment(lib)s. Possible solutions:
Simplest: build all the libraries, this will solve the errors and it's not a problem to link with a library you don't use.
Also simple but slightly less obvious: predefine wxNO_NET_LIB when building your project, this will prevent the file above from autolinking this particular library. You may/will need to define more wxNO_XXX_LIB symbols if you're missing other libraries, of course.
Less simple but arguably the least magic too: stop using $(WXWIN)/include/msvc in your include path, then wx/setup.h under it won't be included and nothing will be linked in automatically. The drawback is that you will have to specify all the libraries you do need to link with manually.

ProGuard issues with Android Archieve(.aar) library

I've a library project which I want to distribute, in AAR format. I've applied ProGuard on it.
ProGuard settings works well if I use this lib as a module, but not when I use resulting AAR. Basically it fails with exception "java.lang.IllegalArgumentException: already added Lmy/lib/package/name/R;" in Application project.
ProGuard is renaming one of my lib class to R, and I feel which is causing problem in Application project as R is used for Resources.
How do I specify proguard mapping in Studio to tell it not to rename to R.
Update:
after adding AAR file as a new module, am getting this error:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lmy/lib/package/name/R;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Okay then, answering myself.
Tried running ProGuard manually on .aar, worked with latest version v5.2.1. Didn't work with default version v4.7 which came with Studio v1.2.2. Hope this helps.

Warning LNK4075 when a C++/CLI project references a static lib project with /ZI (Edit And Continue)

I have the following projects in a Visual Studio 2012 solution:
Native (no /clr) static lib project, compiled with /ZI for Edit And Continue.
C++/CLI DLL project, which references the above static lib.
The C++/CLI project builds with the following warning:
warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
If /OPT:NOLBR is added to the linker options of the C++/CLI project, the warning becomes:
warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
Any attempt to change the incremental linkage setting of the C++/CLI project doesn't change the warning (C++/CLI projects never link incrementally anyway).
I understand that I won't be able to use Edit And Continue in the C++/CLI project, because this is not supported. Indeed, changing /ZI to /Zi (disabling Edit And Continue) in the static lib project eliminates the warning, but I can't do that - other non-CLR consumers of that lib need to use Edit And Continue.
How can I get rid of this warning without disabling Edit And Continue in the static lib (and hopefully without maintaining separate build configuration for native and CLR users of the static lib)? I mean, is there any way to ask the linker to ignore the /EDITANDCONTINUE directive that is embedded in the referenced static lib (much in the same way that /NODEFAULTLIB can ignore /DEFAULTLIB directives)?
I have created a minimal VS solution that reproduces the described issue.
due to '/OPT:LBR' specification
This is a nonsense error message, that linker option is only effective for ARM binaries. This is simply a bug, using /OPT:NOLBR takes the sting out of it and you get the real warning.
Which is accurate enough, although it doesn't win any prizes either, you asked for Edit+Continue support in your static lib project but that is not available for a mixed-mode .NET assembly. The undocumented /IGNORE linker option is available to suppress warning messages but this one is ranked as an "unignorable warning" by Chapell.
You'll have to live with this warning as long as you don't want to change your static lib project. It is completely benign. You won't get it when you recompile it with /Zi.
There is no other way than to
disable "Edit And Continue" in the library
create a separate build configuration for "Edit And Continue (/ZI)" and "Program Database (/Zi)"
Of course: I am not aware that there is a predefined macro to determine between /ZI and /Zi... so you need to define your own preprocessor directive to distinguish between these configurations...
I had the same problem and found the only solution is to delete the .vcxproj and .sln files of the project and create the project again.
But then in an old copy of the same project I found a better solution: I changed in the projectname.vcxproj file the line
Profile true
to
Profile false
and LNK4075 warnings disappeared.
It had been the Visual Studio Profiler who had caused the troubles.

Grails project corrupted in STS?

Along with many class resolution errors, my project suddenly started to display this error on the package:
The type groovy.lang.MetaClass cannot be resolved. It is indirectly referenced from required .class files
- The type groovy.lang.GroovyObject cannot be resolved. It is indirectly referenced from required .class
files
I also noted that the unit tests all are failing to compile and display this error on the TestFor annotation:
- Groovy:class TestFor is not an annotation in #TestFor
- Groovy:unable to resolve class TestFor , unable to find class for
annotation
I have tried to clean the project then to refresh dependencies but still no joy. I quite STS and restarted and tried the clean/refresh as well.
I do get a compile error on one of my .groovy files which complain about undefined classes--but I have added the jar defining those classes to my lib folder and do not see any errors on import of the class.
Any suggestions? Do I have to rebuild the entire project?
It turns out that an undefined symbol that stopped the compile had this result. I wasn't familiar with how STS/Eclipse handles a failure to resolve a class and had expected the class path to have been defined before any actual compiles were completed.
So the answer is to look in the error log for STS, determine if one of my classes are missing, and resolve that first before rabbit-holing down a path like this.

Resources