我一直在努力建立TicTacToeLib&命令行中的TicTacToeMain。由于我没有看到每个项目的Android.mk,我创建了自己的,但导入包时遇到了麻烦。以下是我对TicTacToeLib的看法:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := TicTacToeLib
include $(BUILD_PACKAGE)
#LOCAL_MODULE := TicTacToeLib
#LOCAL_MODULE_CLASS := JAVA_LIBRARIES
#include $(BUILD_JAVA_LIBRARY)
尝试构建一个JAVA库(假设我可以从构建的.jar导入),但是与R.stamp相关的资源有错误。所以,我恢复了构建一个创建apk的包。以下是我对TicTacToeMain的看法:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := TicTacToeMain
include $(BUILD_PACKAGE)
我看到的错误是:
目标Java:TicTacToeMain(out / target / common / obj / APPS / TicTacToeMain_intermediates / classes) external / TicTacToeMain / src / com / example / android / tictactoe / MainActivity.java:25:package com.example.android.tictactoe.library不存在 import com.example.android.tictactoe.library.GameActivity; ^ external / TicTacToeMain / src / com / example / android / tictactoe / MainActivity.java:26:package com.example.android.tictactoe.library.GameView不存在 import com.example.android.tictactoe.library.GameView.State; ^ external / TicTacToeMain / src / com / example / android / tictactoe / MainActivity.java:51:找不到符号 符号:类GameActivity location:class com.example.android.tictactoe.MainActivity Intent i = new Intent(this,GameActivity.class); ^ external / TicTacToeMain / src / com / example / android / tictactoe / MainActivity.java:52:找不到符号 符号:变量GameActivity location:class com.example.android.tictactoe.MainActivity i.putExtra(GameActivity.EXTRA_START_PLAYER, ^ external / TicTacToeMain / src / com / example / android / tictactoe / MainActivity.java:53:包状态不存在 startWithHuman? State.PLAYER1.getValue():State.PLAYER2.getValue()); ^ external / TicTacToeMain / src / com / example / android / tictactoe / MainActivity.java:53:包状态不存在 startWithHuman? State.PLAYER1.getValue():State.PLAYER2.getValue()); ^ 6个错误 make: * [out / target / common / obj / APPS / TicTacToeMain_intermediates / classes-full-debug.jar]错误41
最后,我注释掉了所有的R.string。*用法并构建了一个JAVA库(.jar也已创建),但是TicTacToeMain仍然失败并出现相同的构建错误。真的很感激任何帮助