JAVAH依然不会找到OSX / Android的工作室类文件 [英] Javah still won't find class files in OSX / Android Studio

查看:135
本文介绍了JAVAH依然不会找到OSX / Android的工作室类文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

而在JNI JAVAH错误 -

说完简称一>

...和 ​​- > 机器人 - javah的没有找到我的课

...我还是不能让 javah的工作。具体...

我的java类位于:

<$p$p><$c$c>/Users/HKS/$c$c/MusicPlayer-Android/dspLibrary/src/main/java/com/company/audio/LibDSP.java`

在此文件夹...

  /用户/ HKS / code / MusicPlayer-的Andr​​oid / dspLibrary / src目录/主/爪哇/`
 

...我已经试过运行...

  javah的com.company.audio.LibDSP
javah的-classpath。 com.company.audio.LibDSP
javah的-classpath /应用/安卓\ Studio.app / SDK /平台/ Android为16 /的android.jar :. -jni com.company.audio.LibDSP
 

...我也试过这种从包含的.java 文件的实际文件夹中...

  javah的LibDSP
javah的-classpath。 LibDSP
 

所有给平常...

 错误:无法访问com.company.audio.LibDSP
找不到类文件com.company.audio.LibDSP
的javadoc:错误 - 类com.company.audio.LibDSP没有找到。
错误:没有类在命令行上指定。尝试 - 帮助。
 

任何想法?

附带详细的日志显示一些奇怪的搜索路径...

  [查找路径:/System/Library/Java/JavaVirtualMachines....../Contents/Classes/charsets.jar//Applications/Android Studio.app / SDK /平台/android-16/android.jar:。 ]
 

请注意有似乎没有分离器是带有 -classpath 补充说。我试过pre-挂起:并没有什么区别。我猜想这是在详细的输出,而不是核心功能的错误。

解决方案

明白了!它需要编译的类,而不是源。同时,该类文件夹 - ./编译/中间体/班/调试是从Android的Studio中的项目隐藏。

这是最终为我工作就行了。从我模块的根文件夹( /用户/ HKS / code / MusicPlayer-的Andr​​oid / dspLibrary / ):

  javah的-classpath /应用/安卓\ Studio.app / SDK /平台/ Android为16 /的android.jar:./建/中间体/班/调试-jni -d SRC /主/ JNI -force com.company.audio.LibDSP
 

注意 -d 标志输出文件夹,和 -force 确保其覆盖任何现有的文件。

Having referred to --> Javah error while using it in JNI

...and --> android - javah doesn't find my class

...I still can't get javah to work. Specifically...

My java class is located here:

/Users/HKS/Code/MusicPlayer-Android/dspLibrary/src/main/java/com/company/audio/LibDSP.java`

From this folder...

/Users/HKS/Code/MusicPlayer-Android/dspLibrary/src/main/java/`

...I've tried running...

javah com.company.audio.LibDSP
javah -classpath . com.company.audio.LibDSP
javah -classpath /Applications/Android\ Studio.app/sdk/platforms/android-16/android.jar:. -jni com.company.audio.LibDSP

...I've also tried this from within the actual folder containing the .java file...

javah LibDSP
javah -classpath . LibDSP

All give the usual...

error: cannot access com.company.audio.LibDSP
class file for com.company.audio.LibDSP not found
javadoc: error - Class com.company.audio.LibDSP not found.
Error: No classes were specified on the command line.  Try -help.

Any ideas?

Incidental verbose logs show something strange in the search path...

[ Search Path: /System/Library/Java/JavaVirtualMachines....../Contents/Classes/charsets.jar//Applications/Android Studio.app/sdk/platforms/android-16/android.jar:. ]

Notice how there seems to be no separator for the ones added with -classpath. I've tried pre-pending ":" and it makes no difference. I'm assuming this is a bug in the verbose output rather than the core functionality.

解决方案

Got it! It needs the compiled class, not the source. Also, the class folder - ./build/intermediates/classes/debug is hidden from the project in Android Studio.

This is the line that finally worked for me. From my module's root folder (/Users/HKS/Code/MusicPlayer-Android/dspLibrary/):

javah -classpath /Applications/Android\ Studio.app/sdk/platforms/android-16/android.jar:./build/intermediates/classes/debug -jni -d src/main/jni -force com.company.audio.LibDSP

Note the -d flag is the output folder, and -force ensures it overwrites any existing files.

这篇关于JAVAH依然不会找到OSX / Android的工作室类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆