0
我在我的离子应用程序上使用pouchdb,并且当前正在处理DOMException code:18错误。 该文档要求我更改android的设置。更改android上的webview设置for Ionic应用程序
编辑 我发现我必须做出这些变化MainActivity.java 这是我写的代码。
import android.os.Bundle;
import org.apache.cordova.*;
import android.content.Context;
import android.view.Menu;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class MainActivity extends CordovaActivity
{
WebView webView = null;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
webView = (WebView) findViewById(R.id.webView);
WebSettings settings = webView.getSettings();
settings.setDatabaseEnabled(true);
String databasePath = getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
settings.setDatabasePath(databasePath);
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) {
quotaUpdater.updateQuota(estimatedSize * 2);
}
});
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
}
}
当我编译此,我得到错误 - R.id.webView - >看来我的资源名称不正确,不能在资源发现web视图。我搜索了platforms/android文件夹,但找不到布局文件。 此外,我不使用eclipse,我使用原子编辑器进行离子项目。