我尝试将cn1lib集成到Native Data Transfer,它可以在Extensions-Page上找到。不幸的是,当集成这个lib时,会出现一些构建错误:缺少一些awt类(例如import java.awt.Component;)。
我不知道,为了完成构建,究竟缺少什么。
以下是带有构建错误的完整控制台输出:
[echo] Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
[echo] code size and wider device support
[copy] Copying 80 files to /Users/Klaus/Documents/workspace/GTD/build/tmp
[javac] /Users/Klaus/Documents/workspace/GTD/build.xml:147: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 73 source files to /Users/Klaus/Documents/workspace/GTD/build/tmp
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: /Users/Klaus/Documents/workspace/GTD/src/de/zeitkuenstler/gtd/data/DBXAccess.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[copy] Copying 4 files to /Users/Klaus/Documents/workspace/GTD/build/tmp
[jar] Building jar: /Users/Klaus/Documents/workspace/GTD/dist/GTD.jar
[javac] /Users/Klaus/Documents/workspace/GTD/build.xml:171: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to /Users/Klaus/Documents/workspace/GTD/native/internal_tmp
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:5: error: package java.awt does not exist
[javac] import java.awt.Component;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:6: error: package java.awt does not exist
[javac] import java.awt.Container;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:7: error: package java.awt does not exist
[javac] import java.awt.EventQueue;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:8: error: package java.awt does not exist
[javac] import java.awt.Frame;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:9: error: package java.awt.datatransfer does not exist
[javac] import java.awt.datatransfer.DataFlavor;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:10: error: package java.awt.datatransfer does not exist
[javac] import java.awt.datatransfer.Transferable;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:11: error: package java.awt.datatransfer does not exist
[javac] import java.awt.datatransfer.UnsupportedFlavorException;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:12: error: package java.awt.dnd does not exist
[javac] import java.awt.dnd.DnDConstants;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:13: error: package java.awt.dnd does not exist
[javac] import java.awt.dnd.DropTargetAdapter;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:14: error: package java.awt.dnd does not exist
[javac] import java.awt.dnd.DropTargetDropEvent;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:15: error: cannot find symbol
[javac] import java.io.BufferedInputStream;
[javac] ^
[javac] symbol: class BufferedInputStream
[javac] location: package java.io
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:16: error: cannot find symbol
[javac] import java.io.File;
[javac] ^
[javac] symbol: class File
[javac] location: package java.io
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:17: error: cannot find symbol
[javac] import java.io.FileInputStream;
[javac] ^
[javac] symbol: class FileInputStream
[javac] location: package java.io
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:21: error: cannot find symbol
[javac] import java.net.URLConnection;
[javac] ^
[javac] symbol: class URLConnection
[javac] location: package java.net
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:22: error: package java.nio.file does not exist
[javac] import java.nio.file.Files;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:26: error: package javax.swing does not exist
[javac] import javax.swing.JComponent;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:27: error: package javax.swing does not exist
[javac] import javax.swing.JFrame;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:28: error: package javax.swing does not exist
[javac] import javax.swing.JPanel;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:32: error: package java.awt.dnd does not exist
[javac] java.awt.dnd.DropTarget dropTarget;
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:34: error: cannot find symbol
[javac] private Component findCanvas(Component c, Set<Component> checked) {
[javac] ^
[javac] symbol: class Component
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:34: error: cannot find symbol
[javac] private Component findCanvas(Component c, Set<Component> checked) {
[javac] ^
[javac] symbol: class Component
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:34: error: cannot find symbol
[javac] private Component findCanvas(Component c, Set<Component> checked) {
[javac] ^
[javac] symbol: class Component
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:60: error: cannot find symbol
[javac] private Component findCanvas(Component c) {
[javac] ^
[javac] symbol: class Component
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:60: error: cannot find symbol
[javac] private Component findCanvas(Component c) {
[javac] ^
[javac] symbol: class Component
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:42: error: cannot find symbol
[javac] if (c instanceof JComponent) {
[javac] ^
[javac] symbol: class JComponent
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:45: error: cannot find symbol
[javac] JComponent jc = (JComponent)c;
[javac] ^
[javac] symbol: class JComponent
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:45: error: cannot find symbol
[javac] JComponent jc = (JComponent)c;
[javac] ^
[javac] symbol: class JComponent
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:46: error: cannot find symbol
[javac] Component[] children = jc.getComponents();
[javac] ^
[javac] symbol: class Component
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:47: error: cannot find symbol
[javac] for (Component child : children){
[javac] ^
[javac] symbol: class Component
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:48: error: cannot find symbol
[javac] Component found = findCanvas(child, checked);
[javac] ^
[javac] symbol: class Component
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:61: error: cannot find symbol
[javac] return findCanvas(c, new HashSet<Component>());
[javac] ^
[javac] symbol: class Component
[javac] location: class NativeDragAndDropImpl
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:70: error: cannot find symbol
[javac] Frame[] frames = Frame.getFrames();
[javac] ^
[javac] symbol: class Frame
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:70: error: cannot find symbol
[javac] Frame[] frames = Frame.getFrames();
[javac] ^
[javac] symbol: variable Frame
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:71: error: cannot find symbol
[javac] JPanel canvas = null;
[javac] ^
[javac] symbol: class JPanel
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:72: error: cannot find symbol
[javac] for (Frame frame : frames) {
[javac] ^
[javac] symbol: class Frame
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:73: error: cannot find symbol
[javac] if (frame instanceof JFrame) {
[javac] ^
[javac] symbol: class JFrame
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:74: error: cannot find symbol
[javac] JFrame jframe = (JFrame)frame;
[javac] ^
[javac] symbol: class JFrame
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:74: error: cannot find symbol
[javac] JFrame jframe = (JFrame)frame;
[javac] ^
[javac] symbol: class JFrame
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:75: error: cannot find symbol
[javac] canvas = (JPanel)findCanvas(jframe.getContentPane());
[javac] ^
[javac] symbol: class JPanel
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:81: error: cannot find symbol
[javac] final JPanel fcanvas = canvas;
[javac] ^
[javac] symbol: class JPanel
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:82: error: package java.awt.dnd does not exist
[javac] dropTarget = new java.awt.dnd.DropTarget(canvas, new DropTargetAdapter() {
[javac] ^
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:82: error: cannot find symbol
[javac] dropTarget = new java.awt.dnd.DropTarget(canvas, new DropTargetAdapter() {
[javac] ^
[javac] symbol: class DropTargetAdapter
[javac] /Users/Klaus/Documents/workspace/GTD/lib/impl/native/javase/com/codename1/datatransfer/NativeDragAndDropImpl.java:65: error: cannot find symbol
[javac] EventQueue.invokeLater(new Runnable() {
[javac] ^
[javac] symbol: variable EventQueue
[javac] location: class NativeDragAndDropImpl
[javac] 43 errors
建立失败 /Users/Klaus/Documents/workspace/GTD/build.xml:171:编译失败;有关详细信息,请参阅编译器错误输出。
答案 0 :(得分:1)
当前版本的Eclipse build.xml模板中似乎存在错误。我已经应用了一个将在下一个插件更新中包含的修复程序。与此同时,您需要对build.xml文件进行一些小改动。
在build.xml的第170行附近,有一个javac调用:
<javac destdir="native/internal_tmp" compiler="modern"
source="1.8"
target="1.8"
bootclasspath="lib/CLDC11.jar"
classpath="lib/CodenameOne.jar:${build.classes.dir}:lib/impl/cls:build/tmp">
<src path="native/javase"/>
<src path="lib/impl/native/javase"/>
</javac>
删除bootclasspath=
行,最后得到:
<javac destdir="native/internal_tmp" compiler="modern"
source="1.8"
target="1.8"
classpath="lib/CodenameOne.jar:${build.classes.dir}:lib/impl/cls:build/tmp">
<src path="native/javase"/>
<src path="lib/impl/native/javase"/>
</javac>