I tried to obfuscate my project in j2me..But it is showing the following error.I came to know that this obfuscation error happened only when i importing Json.jar in my project..If i remove this jar means obfuscation is happening..Please help me solve this..Thanks in advance.
Warning: org.json.me.JSONArray: can't find referenced method 'java.lang.Object remove(int)' in class java.util.Vector
Warning: there were 1 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the options
'-dontskipnonpubliclibraryclasses' and/or
'-dontskipnonpubliclibraryclassmembers'.
Error: Please correct the above warnings first.
C:\Users\Ponmani\Documents\TThehinduNov22ponmani\nbproject\build-impl.xml:427: Obfuscation failed with error code 1.
BUILD FAILED (total time: 4 seconds)
This error happens because the JSONArray class uses remove(int) method from Vector class, but this method is not available for Java ME: http://docs.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/java/util/Vector.html
You picked a Java Se version of the library. Please, try this other library: https://github.com/upictec/org.json.me/
Update
There is a ZIP button where you can download the repository as a zip file.
Inside the zip file enter /src/main/java.
Copy org folder and paste it in your src folder.
Related
I am using RoslynPad project to test how external plugins (Class libraries) could be used in the script.
I have created Class Library with a single class and method.
In roslynPad project i have added "plugin_demo" into RoslynHostReferences NamespaceDefault structure.
I have also added reference to plugin dll:
MetadataReference newref = MetadataReference.CreateFromFile("G:\\projects\\demos\\plugin_demo\\plugin_demo\\bin\\Debug\\plugin_demo.dll");
MetadataReferences = MetadataReferences.Add(newref);
Now i see that my new class is seen by diagnostics and autocomplition also works.
The code with a method call compiles fine.
But when i run it i get exception:
Could not load assembly or file. File not found.
I have copied plugin_demo.dll into directory where compiled roslynPad dll resides. Still no result.
I have checked that class library and roslynpad use the same .Code version.
What can be the problem?
What is correct way of adding assemblies to roslyn project?
Thanks
I have solved the problem after debugging. The roslynPad project generates file nams_deps.json when editor is launched. It must be deleted and after that the assembly is found.
I am attempting to convert parts of an Android app to iOS using Doppl, and I am getting a strange result: Doppl keeps trying to pull in android.arch.lifecycle:reactivestreams, even though I don't want it to.
Specifically, in app/build/j2objcSrcGenMain/android/arch/lifecycle/, there is a reactivestrams/ subdirectory with R.h and R.m files in it. This seems to make Xcode cranky and may explain why I had some oddities with pod install.
My app/build.gradle has compile "android.arch.lifecycle:reactivestreams:$archVer", because my activity is using LiveDataReactiveStreams.fromPublisher(). However:
The activity is not in the translatePattern (and since its code is not showing up in app/build/j2objcSrcGenMain/, I have to assume that the translatePattern is fine)
I do not have a doppl statement related to reactivestreams, because there does not appear to be a Doppl conversion of this library (nor should it be needed here)
AFAIK, nowhere else in this app am I referring to LiveDataReactiveStreams, which AFAIK is the one-and-only public class from the reactivestreams library
So, the questions:
What determines whether Doppl creates R.h and R.m files for some dependency? It's not the existence of a doppl statement, as I have doppl statements for a lot of other dependencies (RxJava, RxAndroid, Retrofit) and those do not get R.h and R.m files. It's not whether the dependency is referenced from generated code, as my repository definitely uses RxJava and Retrofit, yet there are no R files for those.
How can I figure out why Doppl generates R.h and R.m for reactivestreams?
Once I get this cleared up... do I re-run pod install, or is there some other pod command to refresh an existing pod with a new implementation?
Look into 'app/build/generated/source/r/debug' and confirm there's an R.java being created for the architecture component. It'll be under 'android/arch/lifecycle/reactivestrams'.
I think there are 2 problems here.
Problem 1
Somehow Doppl/J2objc is of the opinion that this file should be transpiled. It could be either that 'translatePattern' matches with it, or that something in the shared code is referencing it. If you can't figure out which, please post a comment and I'll try to help (or post in slack group).
Problem 2
Regardless of why that 'R.java' is being sucked into the translate step, because of how stock J2objc is configured, the code is being generated with package folders instead of creating One Big Name. That generated file should be called 'AndroidArchLifecycleReactivestramsR.h' (and AndroidArchLifecycleReactivestramsR.m). Xcode really doesn't like package folders. That's why there's a slightly custom J2ojbc being used with Doppl, so we can have files with big names instead of folders.
In cases where you intentionally use package names that match with what J2objc considers to be "system" classes, you need to provide a header mapping file to force long names. The 'androidbase' doppl library needs to add a lot of files that are in the 'android' package, which J2objc considers "system". We override those names in the mapping file.
build.gradle
https://github.com/doppllib/core-doppl/blob/master/androidbase/build.gradle#L19
mapping file
https://github.com/doppllib/core-doppl/blob/master/androidbase/src/main/java/androidbase.mappings
I screwed up.
In my dopplConfig, I have:
translatePattern {
include '**/api/**'
include '**/arch/**'
include '**/RepositoryTest.java'
}
In this case, **/arch/** not only matches my arch package, but also the arch package from the Architecture Components.
Ordinarily, this would not matter, because the Architecture Components source code is not in my project. But, R.java gets generated, due to resources, and the translatePattern includes generated source code in addition to lovingly hand-crafted source code. So, that's where my extraneous Objective-C was coming from.
Many thanks to Kevin Galligan for his assistance with this, out on the #newbiehelp Doppl Slack channel!
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.
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.
I have been using CC.Net successfully for some time, but now I have a problem. I added new solution to CC. It is compiled fine in VS2008, but fails in CC. The main reason is - projects in solution are built in wrong order, with no regard to dependencies. CC just tries to build them in the same order as they are stored on disc (alphabetical order).
For example, in solution there is proect Proj1 and Proj2, Proj1 has reference to Proj2. On CCNET Proj1 is built before Proj2 and throws error "CSC : error CS0006: Metadata file 'D:\xxx\Proj2\bin\Debug\Proj2.dll' could not be found".
I know this could happen when devenv is used to build solutions, but I use MSBuild.
The following code is responsible for building:
<exec>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<baseDirectory>code\src</baseDirectory>
<buildArgs>/p:Configuration=Debug /t:Rebuild PM.sln</buildArgs>
<buildTimeoutSeconds>1200</buildTimeoutSeconds>
</exec>
What am I doing wrong?
The error Metadata file could not be found:
When it happened to me, it was because there was a file called proj1.exe at that location that should not have been there. So when it used proj1.exe as the reference (instead of a proj1.dll), proj1.exe's reference to a local System.EnterpriseServices.dll failed. This was happening to me with proj1.exe referencing System.EnterpriseServices.dll which referenced System.EnterpriseServices.Wrapper.dll. Where proj1.exe was not supposed to be included in the build but someone had named a unit test app project against our team conventions.
So I recommend checking the references in the project files(unload project and edit project in vs2010 or open each project file with a text or xml editor) to make sure they are ProjectReference not Reference. Also try doing the build with /v:d in the buildArgs list so you get a more detailed build log that will show you where files were resolved to and in what order. Aa different reference that is 'successfully' resolved could be attempting to load x.dll that directly locally references your D:\xxx\Proj2\bin\Debug\Proj2.dll but fails.