//Android webview 设置cookie
public void synCookies(Context context, String url, String cookie) {
CookieSyncManager.createInstance(context);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.setCookie(url, cookie);//cookies是在HttpClient中获得的cookie
CookieSyncManager.getInstance().sync();
}
//调用:
synCookies(MainActivity.this, ".xxx.com", "token=" + tokenBean.getToken());
注意:设置cookie时,是 .caocao.com ,记住前面有个点
参考文献 https://blog.csdn.net/gyh790005156/article/details/53100924
集成微信支付闪退:
按照以下几点来检查,
1,你签名中的key,也就是你的API密钥key,这个参数要你们自己到商户平台设置的,设置的规则是32位数字与字母大小写的组合的随机数,不能设置成签名串和参数appsecret,你们有正确设置吗???
2,检查开放平台对应的包名与签名是否有正确设置。
https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=8_5 这里有详细的设置说明。
3,调用支付使用的noncestr这个参数必须和商家服务器调用统一下单接口返回的那个noncestr一致
4, 从预支付订单返回的数据 ,没有重新签名,也会引起这个问题。 (目前我是因为后台获取到预支付id后,没有进行数据二次签名,导致闪退)
5,重新安装微信后试试。
**
**
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processBxzxDebugManifest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:540)
at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:173)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
at sun.reflect.GeneratedMethodAccessor213.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
... 33 more
解决方案
mac执行 ./gradlew assembleDebug --stacktrace 查看具体错误
这边遇到的问题是,依赖库中的minSdk和当前项目的不一致,解决该错误,改成一致的即可
uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.github.razerdp:BasePopup:2.1.9] /Users/zhaoshunchen/.gradle/caches/transforms-1/files-1.1/BasePopup-2.1.9.aar/88668d5e7816d523f8df1074f1e86b57/AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 16,
or use tools:overrideLibrary="razerdp.library" to force usage (may lead to runtime failures)
腾讯x5 webview SmartRefreshLayout 下拉刷新冲突
public class WebView4Scroll extends WebView {
public WebView4Scroll(Context context, AttributeSet attrs) {
super(context, attrs);
}
public WebView4Scroll(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public WebView4Scroll(Context context) {
super(context);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
LogUtils.e("onTouchEvent");
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (this.getScrollY() <= 0)
this.scrollTo(0, 1);
break;
case MotionEvent.ACTION_UP:
// if(this.getScrollY() == 0)
// this.scrollTo(0,-1);
break;
}
return super.onTouchEvent(event);
}
public interface IScrollListener {
void onScrollChanged(int scrollY);
}
private IScrollListener mScrollListener;
public void setOnScrollListener(IScrollListener listener) {
mScrollListener = listener;
}
//当onScrollChanged 该方法失效是,查看h5页面当中是否也存在自身也存在上下拉刷新,如果存在。有可能是h5中的影响到安卓原生
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
//只要是通过webview的滚动距离 t
if (mScrollListener != null) {
mScrollListener.onScrollChanged(t);
}
}
}