Javac producing error with no origin - ant

I am using javac in ant to compile a project and I am getting an compilation error message without the file or line number. Why is this and how can i find where in the (large) project the problem is?
build.xml
make_folders:
compile:
[javac] Compiling 33 source files to *project root*/bin/classes
[javac] error: incompatible types: String cannot be converted to Integer
[javac] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[javac] 1 error
BUILD FAILED
*project root*/build.xml:33: Compile failed; see the compiler error output for details.
And heres the relevant lines with verbose set to true:
[javac] [loading ZipFileIndexFileObject[/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/ct.sym(META-INF/sym/rt.jar/java/util/Date.class)]]
[javac] error: incompatible types: String cannot be converted to Integer
UPDATE:
So I managed to figure out that the error it was originating from calling a function in a class from within an inner class in said outer class. I'm not sure why this produced an error or why it was presented with such little information so any help would still be appreciated.

Related

Error after add simple_permission or permission_handler on flutter

I want to create a folder to try downloading files. so I added simple_permission but I got an error migrating to androidX even though I migrated to androidX. how can I resolve this error?
Launching lib\main.dart on Coolpad E502 in debug mode...
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:10: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:156: error: cannot find symbol
ActivityCompat.requestPermissions(activity, perm, 0);
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:163: error: cannot find symbol
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, permission);
^
symbol: variable ContextCompat
location: class SimplePermissionsPlugin
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:171: error: cannot find symbol
if (ActivityCompat.shouldShowRequestPermissionRationale(registrar.activity(), permission)) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:175: error: cannot find symbol
if (ActivityCompat.checkSelfPermission(registrar.context(), permission) == PackageManager.PERMISSION_GRANTED) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
6 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':simple_permissions:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 45s
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.\
Exited (sigterm)
I had the same error and what I did was change the version of klotin in the build.gradle file I have it as follows
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}
}

Can't build OpenCV 3.1 on Windows (using MinGW)

I need to build OpenCV from source, because I want to make modifications to it. So using pre-built binaries is not an option for me. I'm doing this on Windows 8. I do not have MS Visual Studio, and I don't want to use it.
Here is how I reproduce the build error:
I git clone https://github.com/opencv/opencv
I use CMake 3.7.1, press Configure, then press Generate. It seems to work (no errors). I named the output folder opencv/release.
I go to the opencv/release folder, and type mingw32-make.
Eventually, after compiling for a while, it displays the following error message:
Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/parallel.cpp.obj
modules\core\src\parallel.cpp:135:43: error: operator '&&' has no right operand
modules\core\src\parallel.cpp: In function 'void cv::parallel_for_(const cv::Range&, const cv::ParallelLoopBody&, double)':
modules\core\src\parallel.cpp:311:52: error: 'parallel_for_pthreads' was not declared in this scope parallel_for_pthreads(range, body, nstripes);
^
modules\core\src\parallel.cpp: In function 'int cv::getNumThreads()':
modules\core\src\parallel.cpp:370:50: error: 'parallel_pthreads_get_threads_num' was not declared in this scope return parallel_pthreads_get_threads_num();
^
modules\core\src\parallel.cpp: In function 'void cv::setNumThreads(int)':
modules\core\src\parallel.cpp:431:46: error: 'parallel_pthreads_set_threads_num' was not declared in this scope parallel_pthreads_set_threads_num(threads);
^
modules\core\CMakeFiles\opencv_core.dir\build.make:990: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/parallel.cpp.obj' failed mingw32-make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/parallel.cpp.obj] Error 1
Note: I tried to compile both with and without TPP (in the CMake config), and I get the same error message.
Also, I read the other similar questions on StackOverflow and the answers do not help.

Error while building with Buildozer

I am fairly new to Kivy and Android app development. I did a basic hello world app with Kivy and was trying to make an APK from it with Buildozer. These were the errors that I see:
-compile:
[javac] Compiling 11 source files to /home/ratul/Devel/Python/Kivy/test/.buildozer/android/platform/python-for-android/dist/ratulsapp/bin/classes
[javac] /home/ratul/Devel/Python/Kivy/test/.buildozer/android/platform/python-for-android/dist/ratulsapp/src/org/renpy/android/PythonService.java:64: error: cannot find symbol
[javac] notification.setLatestEventInfo(context, serviceTitle, serviceDescription, pIntent);
[javac] ^
[javac] symbol: method setLatestEventInfo(Context,String,String,PendingIntent)
[javac] location: variable notification of type Notification
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 1 error
BUILD FAILED
/home/ratul/Devel/Android/Sdk/tools/ant/build.xml:716: The following error occurred while executing this line:
/home/ratul/Devel/Android/Sdk/tools/ant/build.xml:730: Compile failed; see the compiler error output for details.
I don't understand where the problem is coming from. I tried specifying version from main.py but that doesn't help either. Any pointers? Thanks in advance.
Notification.setLatestEventInfo is removed in API Level 23 (Android 6.0):
https://developer.android.com/sdk/api_diff/23/changes/android.app.Notification.html
Here some solutions to use instead: How to implement the deprecated methods of Notification

Compile legacy Java code with java1.6 JDK

I'm compiling many legacy Java code probably written with Java1.3 and I got tons of errors like this:
Copydir.java:128: warning: as of release 5, 'enum' is a keyword, and may not be used as an identifier
[javac] (use -source 5 or higher to use 'enum' as a keyword)
[javac] Enumeration enum = filecopyList.keys();
It's too time consuming to replace each instance of enum with _enum so I added source="1.3" in ant javac task as below (based on examples from http://ant.apache.org/manual/Tasks/javac.html). But I still got the same compile error. I've tried to change source = 1.4,1.5, and still same error.
<javac srcdir="${src.dir}"
destdir="${build.classes}"
debug="true" debuglevel="lines,vars,source"
source="1.3"
deprecation="off"
optimize="on">
What is the right way to tell comiler that the source is written in 1.3, but I want to compile it to run in 1.6? I'm using jdk1.6.0.26 and ant 1.8.2
That's a warning, not an error. Unless there are other errors in the build that should work just fine.

How do I reference the -s flag for javac in an ant script?

I am trying to compile the canonical metamodel classes for some JPA entities using an ant script. I am using OpenJPA. I would like the generated files to be located in a subdirectory which, according to the OpenJPA documentation, I can do by specifying the -s option for javac. The way I am trying to do this right now is like this:
<compilerarg value="-s c:\buildfiles"/>
However, I keep getting an error that says:
javac: invalid flag: -s
Usage: javac <options> <source files>
If I do:
<compilerarg value="-version"/>
it tells me that I am using 1.6. And if I do:
<compilerarg value="-help"/>
it lists -s as a valid option. Does anybody have any advice on what I can do to accomplish what I'm trying to do? Thank you!
You have two args in there, with a space between them. You just need to separate them:
<compilerarg value="-s"/>
<compilerarg value="c:\buildfiles"/>
At the moment you're parsing the single arg "-s c:\buildfiles". If you run
ant -verbose
you can verify this - you'll see something like:
[javac] Compilation arguments:
[javac] '-classpath'
[javac] ''
[javac] '-sourcepath'
[javac] '/a/b/c'
[javac] '-target'
[javac] '1.5'
[javac] '-g:none'
[javac] '-s c:\buildfiles' <-- here is the problem
[javac] '-source'
[javac] '1.5'
[javac]
[javac] The ' characters around the executable and arguments are
[javac] not part of the command.

Resources