Running an Imported android project - java

I have a problem with running an imported android project. In fact, when i run it i get an error from BuildConfig.java ( this file is not editable) the error is
"Error:(18, 69) error: illegal escape character".
and this is the line that the error is pointing to:
public static final String[] TRANSLATION_ARRAY = new String[]{"C:\gpslogger\gpslogger\src\main\res\values","C:\gpslogger\gpslogger\src\main\res\af","C:\gpslogger\gpslogger\src\main\res\ar","C:\gpslogger\gpslogger\src\main\res\ca","C:\gpslogger\gpslogger\src\main\res\cs","C:\gpslogger\gpslogger\src\main\res\cy","C:\gpslogger\gpslogger\src\main\res\da","C:\gpslogger\gpslogger\src\main\res\de","C:\gpslogger\gpslogger\src\main\res\el","C:\gpslogger\gpslogger\src\main\res\es","C:\gpslogger\gpslogger\src\main\res\es-ES","C:\gpslogger\gpslogger\src\main\res\es-MX","C:\gpslogger\gpslogger\src\main\res\es-PE","C:\gpslogger\gpslogger\src\main\res\fa","C:\gpslogger\gpslogger\src\main\res\fi","C:\gpslogger\gpslogger\src\main\res\fr","C:\gpslogger\gpslogger\src\main\res\fr-CA","C:\gpslogger\gpslogger\src\main\res\gl","C:\gpslogger\gpslogger\src\main\res\he","C:\gpslogger\gpslogger\src\main\res\hi","C:\gpslogger\gpslogger\src\main\res\hr","C:\gpslogger\gpslogger\src\main\res\hu","C:\gpslogger\gpslogger\src\main\res\is","C:\gpslogger\gpslogger\src\main\res\it","C:\gpslogger\gpslogger\src\main\res\ja","C:\gpslogger\gpslogger\src\main\res\ko","C:\gpslogger\gpslogger\src\main\res\lt","C:\gpslogger\gpslogger\src\main\res\lv","C:\gpslogger\gpslogger\src\main\res\mk","C:\gpslogger\gpslogger\src\main\res\ms","C:\gpslogger\gpslogger\src\main\res\nl","C:\gpslogger\gpslogger\src\main\res\no","C:\gpslogger\gpslogger\src\main\res\pl","C:\gpslogger\gpslogger\src\main\res\pt","C:\gpslogger\gpslogger\src\main\res\pt-BR","C:\gpslogger\gpslogger\src\main\res\pt-PT","C:\gpslogger\gpslogger\src\main\res\ro","C:\gpslogger\gpslogger\src\main\res\ru","C:\gpslogger\gpslogger\src\main\res\sk","C:\gpslogger\gpslogger\src\main\res\sl","C:\gpslogger\gpslogger\src\main\res\sr","C:\gpslogger\gpslogger\src\main\res\sv","C:\gpslogger\gpslogger\src\main\res\sv-SE","C:\gpslogger\gpslogger\src\main\res\ta","C:\gpslogger\gpslogger\src\main\res\th","C:\gpslogger\gpslogger\src\main\res\tl","C:\gpslogger\gpslogger\src\main\res\tr","C:\gpslogger\gpslogger\src\main\res\uk","C:\gpslogger\gpslogger\src\main\res\vi","C:\gpslogger\gpslogger\src\main\res\zh","C:\gpslogger\gpslogger\src\main\res\zh-CN","C:\gpslogger\gpslogger\src\main\res\zh-TW"};

\g is an illegal escape character in "C:\gps..."
All windows path strings need to have \\, for example "C:\\"
You should find the file that is editable and correct those strings
P.S. the (18, 69) in the error means line 18, column 69 of the file.

Related

Problems with encoding in IntellijIDEA on Windows

When I launch my program, it crashes on the line
String[] words = tdElement.text().replaceAll("[^a-zA-Zа-яА-Я ]", " ").split(" ");
with the following exception:
Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal character range near index 16
[^a-zA-ZР°-СЏРђ-РЇ ]
This "tdElement" contains both English and Russian letters. When there is no Russian letters in the "tdElement", everything works fine. I tried to go to "Settings" -> "File Encodings" and set the "Global Encoding", "Project Encoding" and "Default encoding for properties files" fields to UTF-8, but it didn`t work. Thank you in advance

Dropwizard - On deployment, application fails to run due to a malformed yml file

We are trying to add in automated metrics to our Java Application, with Dropwizard metrics. So far, the config.yml file looks like this:
metrics:
reporters:
- type: log
logger: metrics
frequency: 5 minute
includes: "io.dropwizard.jetty.MutableServletContextHandler.active-requests","io.dropwizard.jetty.MutableServletContextHandler.active-dispatches","io.dropwizard.jetty.MutableServletContextHandler.active-suspended"
When running this project, we get an error stating that the yaml file is malformed:
io.dropwizard.configuration.ConfigurationParsingException: test/config.yml has an error:
* Malformed YAML at line: 24, column: 82; while parsing a block mapping
in 'reader', line 20, column 5:
- type: log
^
expected <block end>, but found FlowEntry
in 'reader', line 23, column 81:
... tContextHandler.active-requests","io.dropwizard.jetty.MutableSer ...
^
What exactly is wrong with the way the yaml is written here? My understanding is that the indentation, the spaces, and not having commas in within quotes were correct for this, and we're not able to find any other issues.
Just change line 6 to
includes: [io.dropwizard.jetty.MutableServletContextHandler.active-requests,io.dropwizard.jetty.MutableServletContextHandler.active-dispatches,io.dropwizard.jetty.MutableServletContextHandler.active-suspended]

synonyms() error in wordnet

I want to use synonyms () described in 'Intro to the tm package' for R. It uses the wordnet package. The wordnet package downloaded from CRAN does not have Dict (dictionary) in its directory. I downloaded it from the Princeton site and copied it over to the directory. After using sys.setenv() and setDict() for setting paths, I still get this error:
Error in sort(unique(unlist(lapply(synsets, getWord))))
error in evaluating the argument 'x' in selecting a method for function 'sort': Error in unique(unlist(lapply(synsets, getWord))) :
error in evaluating the argument 'x' in selecting a method for function 'unique': Error in .jcall(synset, "Ljava/util/List;", "getWord") :
java.lang.NumberFormatException: For input string: "t"
when I try synonyms("company", pos = "NOUN") or another English word in place of 'company'. The problem is in getSynonyms() called from synonyms(). Any idea on how to fix this problem?
Different combinations lead to different input string NumberFormatException. My Java is version 1.8. I tried all the online resources. I added two paths to PATH for R's bin and RJava's jri. Discussion on the exception indicates it is a string to numeric conversion issue. I have made sure that Java to R linkage (via rJava) works (URL: https://www.rforge.net/rJava/ ).

Android Studio build file R broken

I am working on an android app which has worked and been tested many times. Today, however, in attempting to run the application for further testing, I have encountered the following error message:
C:\Users\1000\AndroidStudioProjects\WarofSol\app\build\generated\source\r\debug\com\blacktentdigital\warofsol\R.java
Error:(1251, 32) error: identifier expected
Error:(1251, 34) error: illegal start of type
Error:(1251, 35) error: identifier expected
Error:Execution failed for task ':app:compileDebugJava'.
Compilation failed; see the compiler error output for details.
>Information:BUILD FAILED
The problem is in the R.java file (as listed above). It is a generated file, so I've never touched it.
The offending line is this:
public static final class drawable {
public static final int 3=0x7f020000;
Hover over the offending line gives the following warning: "Identifier expected | Unexpected token"
Comparisons to other R files reveal that the "3" is not supposed to be a 3, and is evidently corrupted.
Attempts to replace the line or file with older backed-up versions have failed to produce any result because (evidently) the file is regenerating the wrong way each time I attempt the build, and I have no idea what might cause this. As I say, the problem sprang up suddenly without any provocation of which I am aware.
I've also attempted closing the program and restarting the computer to no avail.
Any ideas as to what might cause this and how it might be fixed?
I did get the Same error when i have defined a String in xml file like this.
<string name="3">Settings</string>
Error:
Error:(1426, 32) error: <identifier> expected
Error:(1426, 34) error: illegal start of type
Error:(1426, 35) error: <identifier> expected
Error:Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Solution: Resource name must begin with character.
So i have just change String like <string name="S3">Settings</string> and it worked.
So just check if you have any resource name 3 in all your resource file(string.xml, style.xml, attrs.xml) and folder(drawable, layout).
This is a quote from java documentation:
A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "_".
And you named drawable with digit, that caused the problem.

Porter2 Stemming Java Implementation Inquiry

I've seen other posts about this but I still couldn't get it to work.
http://snowball.tartarus.org/dist/libstemmer_java.tgz <<- this contains the java implementation of the porter2 algorithm.
What I did was extract the contents on my desktop (for easy access) and opened its .java file using Netbeans IDE. I ran it but it returned an error.
Netbeans doesn't read the other java files. Since all the java files are connected to each other, one error from javaX file produces error on javaY file and so on.
TestApp.java is the one which should be ran. But the following errors occur. See the screenshots.
Here are the screenshots:
http://img248.imageshack.us/img248/290/java1.jpg
http://img4.imageshack.us/img4/5196/java2l.jpg
http://img441.imageshack.us/img441/8625/java3i.jpg
I cannot see your images any longer. The ext folder will not compile because of 3 unreachable statements in frenchStemmer.java. They can easily be removed, or just delete the entire file if you are not using french.
case 13:
// (, line 155
// call RV, line 155
if (!r_RV())
{
return false;
}
// fail, line 155
// (, line 155
// <-, line 155
slice_from("ant");
return false;
break; <<<- remove this
I compiled and ran in the free Community Edition of Intellij, and also using the command line.

Categories

Resources