简体   繁体   English

如何在Intellij IDEA或Android Studio中搜索未解析的库?

[英]How to search unresolved libraries in Intellij IDEA or Android Studio?

I'm trying to port Apache Flink to Android. 我正在尝试将Apache Flink移植到Android。 One of the biggest problem is that some java tools doesn't exist for Android, but these conflict are not detected at compile time and the errors ( NoClassDefFoundError excpetion) are detected only at runtime. 最大的问题之一是,Android不存在某些Java工具,但是在编译时未检测到这些冲突,并且仅在运行时检测到错误( NoClassDefFoundError排除)。

For example, Java's ManagementFactory doesn't exists for android, BUT no compile error is thrown even if in this class there are unresolved symbols/libraries, in particular: 例如,对于Java而言,Java的ManagementFactory不存在,但是即使在此类中存在未解决的符号/库,也不会引发编译错误,尤其是:

import javax.management.MBeanServer;

import java.lang.management.BufferPoolMXBean;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryType;
import java.lang.management.MemoryUsage;

Now, I included the Flink's jars (flink-clients, flink-java, flink-runtime and flink-streaming) in my Android Studio project and I would like to search all these kind of unresolved dependencies to avoid these kind of exception at runtime. 现在,我将Flink的jar(flink-clients,flink-java,flink-runtime和flink-streaming)包含在我的Android Studio项目中,并且我想搜索所有这些未解析的依赖项,以避免在运行时出现此类异常。 There is any Android Studio tool for this purpose? 有没有用于此目的的Android Studio工具?

I think including jar dependencies in the project will not make Android Studio and a compiler to search for missing classes in already built jars. 我认为在项目中包含jar依赖项不会使Android Studio和编译器在已构建的jar中搜索缺少的类。 Try to include src of flink into your project. 尝试将flink的src包含到您的项目中。 I tried that and I had all unresolved imports being red. 我试过了,所有未解决的进口都变成红色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM