如题:安卓平台无法加载本地的文件 我将JS C++ JAVA里的变量打印出来了,麻烦帮我看下是什么问题? 同样的代码在IOS上正常。
资源文件:./res/web/login.html
JS:
webView.loadURL(”web/login.html“);
C++打印得:
void WebViewImpl::loadFile(const std::string &fileName) {
LOGE(“play2lean loadFile>>>>>>%s”,fileName.c_str());
auto fullPath = getUrlStringByFileName(“res/web/login.html”);
LOGE(“play2lean loadFile fullPath>>>>>>%s”,fullPath.c_str());
loadFileJNI(_viewTag, fullPath);
}
07-09 10:54:12.633: E/(5784): play2lean loadFile fullPath>>>>>>/data/data/com.ddkids.play2learn/files/debugruntime/res/web/login.html
JAVA 打印:
public static void loadFile(final int index, final String filePath) {
Log.e(“play2learn”,“filePath>>”+filePath);
if (CocosPlayClient.isEnabled() && !CocosPlayClient.isDemo()) {
CocosPlayClient.updateAssets(filePath);
}
CocosPlayClient.notifyFileLoaded(filePath);
sCocos2dxActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Cocos2dxWebView webView = webViews.get(index);
if (webView != null) {
Log.e("play2learn","filePath:"+filePath);
webView.loadUrl(filePath);
}
}
});
}
07-09 10:54:12.639: E/play2learn(5784): filePath:/data/data/com.ddkids.play2learn/files/debugruntime/res/web/login.html