I want to generate headers using javah but when i do i get an error:
Error: cannot access android.support.v4.app.FragmentActivity
class file for android.support.v4.app.FragmentActivity not found
I created new External Tool with this parameters:
Location: D:\Android\jdk1.7.0_51\bin\javah.exe
Working Directory: D:\Android\workspace\MyApp\bin\
Arguments: -d D:\Android\workspace\MyApp\jni -classpath D:\Android\workspace\MyApp\bin\classes;D:\Android\workspace\appcompat_v7\libs\android-support-v7-appcompat.jar com.example.myapp.MainActivity
I use last version of Android SDK and NDK as last version of Java.
Any suggestions?
This can be solved by adding android-support-v4.jar to your javah class path arguments.
I am not an Android developer, this was a result of hunting around on Google (for example, information derived indirectly from the answer to IntelliJ 12 + ActionBarSherlock setttings: Could not find class 'android.support.v4.app.FragmentActivity'). I do not know why this is required in addition to standard v7 jars, and I am posting this answer as community wiki in hopes that somebody with more experience can edit it to add some more information in the future.
Related
I am trying to fork AndroidPdfViewer to replace its underlying library from PdfiumAndroid to android-pdfium.
My problem is, when I load AndroidPdfViewer and PdfiumAndroid in Android Studio, I can't get the project to work, even before changing anything.
The problem is PdfiumAndroid has JNI code that define many previously declared functions, but the linker can't link the definitions in C++ to the declarations in Java. The error message has two errors:
E/barteksc.sample: No implementation found for long com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(int, java.lang.String) (tried Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument and Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument__ILjava_lang_String_2)
E/PDFView: load pdf error
java.lang.UnsatisfiedLinkError: No implementation found for long com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(int, java.lang.String) (tried Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument and Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument__ILjava_lang_String_2)
at com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(Native Method)
at com.shockwave.pdfium.PdfiumCore.newDocument(PdfiumCore.java:135)
Here is the gradle file. It looks like there is something missing, although these are the original files before any modifications.
I tried to add this to proguard-rules.pro
-keep class com.shockwave.** { *; }
it removed the first error, but the second is still there.
Solved it.
If anyone is having the same issue, I did the following to solve it:
Installed android-ndk tools
Edited Application.mk file to remove mips and mips64 since they are not supported anymore, and updated android version to 19 since it's the minimum right now.
run ndk-build in the jni folder / directory.
That created what I was said about in my question
It looks like there is something missing
That created a libs folder that has the necessary definitions for the linker.
i try for 2 days to generate a documentation on android studio Bumblebee, i have try multiples possibility, generate documentation with -sourcepath /path/android.jar, command line in shell javadoc with just a class.java, select Jdk embedded in build deployment gradle, custom scope project, and more... but i have the same problem :
error: package does not exist
error: cannot find symbol
error: static import only from classes and interfaces
have you a solution ? thank you for helping me
I have seen this question asked and answered a few times for Java being compiled in Eclipse. In my case, I don't have Eclipse. I want to get my project compiled using VS Code. I'm hoping there is a file I can create or edit to override this error message:
Access restriction: The type 'Pair' is not API (restriction on
required library 'C:\Program
Files\Java\jdk1.8.0_201\jre\lib\ext\jfxrt.jar')Java(16777523)
Any help appreciated.
In my project the .settings\org.eclipse.buildship.core.prefs contains
connection.project.dir=../..
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
PS My project uses gradle.
try this:
1.find .settings\org.eclipse.jdt.core.prefs file in your project
2.change org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
to org.eclipse.jdt.core.compiler.problem.forbiddenReference = ignore
change file ./.settings/org.eclipse.jdt.core.prefs with
org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
run the command
mvn eclipse:eclipse
I'm new in Android SDK. I'm using Emacs as IDE (I know about Android Studio). I created a project and I compiled it from a script named gradlew (It was created automatically when the project was created). APK is created successfully. Now, I'm trying to implement (with FlyMake) syntax error checker. The command used to do this is the following:
javac "main.java"
where main.java is the main of the application (there is only one file).
Obviously, javac doesn't know where is the SDK (API level 20). So I tell it as follow:
javac -sourcepath "~/opt/android/sources/android-20" "main.java"
but it throws a lot of errors like "class not found". For example:
/home/carlos/opt/android/sources/android-20/android/app/Activity.java:29: error: cannot find symbol
import android.content.IIntentSender;
^
symbol: class IIntentSender
location: package android.content
When I see the content of android/content, there is not a .java named IIntentSender
So, what's happening? Thanks for reading and answering!
This question was answered by CommonsWare:
The last time I used javac by hand, I used -classpath, not -sourcepath. The appropriate JAR for -classpath would be ~/opt/android/platforms/android-20/android.jar, assuming that ~/opt/android/ is where your Android SDK is installed. IIntentSender is generated Java source code (from AIDL) and will not be in Java form in the SDK sources directory. So, if FlyMake requires -sourcepath, I expect that you're going to be in a world of hurt.
Thanks!
Hi I am getting the error taskdef A class needed by class org.apache.jasper.JspC cannot be found: Could not initialize class org.apache.jasper.JspC when I tried to build the build.xml file. can anyone please give me a solution. Thanks in advance
I added the following to my ant classpath:
/usr/local/apache-tomcat-7/bin/tomcat-juli.jar
I had this problem too, but it was a long time ago and unfortunately my memory has become quite foggy on the subject.
As I recall, you need to start ANT with the -lib command line switch and have it point to some jar files that are needed by Jasper's JSP compiler. Again, I don't remember exactly which ones, but I think the JDK's tools.jar was one of them, as well as all the jars with jasper in the names, and commons-logging.jar and commons-el.jar. You'll have to do some experimenting :).
Do you have the required Jasper libraries in your classpath?
That is a relatively high level exception. If you would like to know more detail about what is missing from your classpath, you can run ant with the -verbose flag on the commandline.
It would be good to see the build.xml that you are using. Apache has put an example out here, which sounds similar to what you are using. If so, it requires that you specify some vars.
For this example Apache suggests:
The following command line can be used to run the script (replacing the tokens with the Tomcat base path and the path to the webapp which should be precompiled):
$ANT_HOME/bin/ant -Dtomcat.home=<$TOMCAT_HOME> -Dwebapp.path=<$WEBAPP_PATH>
If you are getting this error in eclipse "taskdef A class needed by class org.apache.jasper.JspC cannot be found: Could not initialize class org.apache.jasper.JspC",
jasper-compiler.jar consists of "org.apache.jasper.JspC", so please copy the commons-collections.jar in the same dirctory.
jasper-compiler.jar will be in C:\jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar.
Hope it will resolve the issue.