解析:参数类型传错会提示此错误,例如:textView.setText(int i);应该传String类型的值,**textView.setText(String.valueOf(int i));**改成这样就没事了。
解析:arm的so只留下这两个目录:armeabi 和 armeabi-v7a ,其他都删掉。所以把arm-v8的so删掉就好了。
解析:这个错误是我在用ksoap2库请求后台WebService接口时报出的错误,下面是Android的网络请求方法
/**
* webservice请求
* @param wsdl 接口地址
* @param namespace 命名空间
* @param method 接口方法名
* @param json 请求参数
* @return 结果
*/
private String requestWebService(String wsdl, String namespace, String method, JSONObject json){
String result = “”;
SoapObject soapObject = new SoapObject(namespace, method);
if(json!=null)
soapObject.addProperty(“arg0”, json.toString());
SoapSerializationEnvelope soapSerializationEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapSerializationEnvelope.bodyOut = soapObject;
soapSerializationEnvelope.dotNet = false;
HttpTransportSE httpTransportSE = new HttpTransportSE(wsdl,Constants.INSTANCE.getNET_OUT_TIME());
httpTransportSE.debug = true;
//添加HeaderProperty信息,解决调用call的时候报java.io.EOFException错误
ArrayList headerPropertyArrayList = new ArrayList<>();
headerPropertyArrayList.add(new HeaderProperty(“Connection”, “close”));
try {
httpTransportSE.call(method, soapSerializationEnvelope,headerPropertyArrayList);
if(soapSerializationEnvelope.getResponse()!=null){
result = soapSerializationEnvelope.getResponse().toString();
}
} catch (SocketTimeoutException e) {
e.printStackTrace();
result = buildErrorJson(“408”,“请求超时”);
}catch (Exception e) {
e.printStackTrace();
if (TextUtils.isEmpty(result)) {
result = buildErrorJson(“404”, “网络异常,获取数据失败”);
}
}
return result;
}
为什么会出现这个错误呢?先看下咱们是怎样发请求的!首先,SoapObject soapObject = new SoapObject(namespace, method); 这句话配置了namespace(命名空间,学过j2ee的应该都知道,这里不再细述)method(方法名,也就是服务端开放的方法),除了这两个,另外一个重点就是action名称,看这句话httpTransportSE.call(method, soapSerializationEnvelope,headerPropertyArrayList); 这里的method和上一句是同一个对象,也就是说,我这里的接口方法名和action的名字是一模一样的,所以如果后台配置的这两个名字不一样,那就会报上面这个错误信息,后台也不会收到你发的请求,它更不会报错。
**解决方案:**知道原因就好办了,如果你是Android端开发者,可以用浏览器访问wsdl 地址(例如:http://192.168.1.105:8080/delivery/ws/deliveryWsImpl?wsdl )找到要请求的方法名,检查下soapAction的名称是否正确,比如下图的名称 soapAction="getApplicationEquipmentList "多了一个空格,就会导致请求失败
其实还有另一种解决方案,就是请求的时候不传action名,直传方法名,也就是这样**httpTransportSE.call("", soapSerializationEnvelope,headerPropertyArrayList); **第一个参数是空字符串,这样也可以请求成功,不过还是建议第一种方案。
如果想了解下后台是如何配置WebService请求的可以看这里Apache CXF配置
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:app:compileDefault_channelDebugKotlin’.
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. r u n ( D e f a u l t T a s k G r a p h E x e c u t e r . j a v a : 256 ) a t o r g . g r a d l e . i n t e r n a l . p r o g r e s s . D e f a u l t B u i l d O p e r a t i o n E x e c u t o r 1.run(DefaultTaskGraphExecuter.java:256) at org.gradle.internal.progress.DefaultBuildOperationExecutor 1.run(DefaultTaskGraphExecuter.java:256)atorg.gradle.internal.progress.DefaultBuildOperationExecutorRunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor R u n n a b l e B u i l d O p e r a t i o n W o r k e r . e x e c u t e ( D e f a u l t B u i l d O p e r a t i o n E x e c u t o r . j a v a : 328 ) a t o r g . g r a d l e . i n t e r n a l . p r o g r e s s . D e f a u l t B u i l d O p e r a t i o n E x e c u t o r . e x e c u t e ( D e f a u l t B u i l d O p e r a t i o n E x e c u t o r . j a v a : 199 ) a t o r g . g r a d l e . i n t e r n a l . p r o g r e s s . D e f a u l t B u i l d O p e r a t i o n E x e c u t o r . r u n ( D e f a u l t B u i l d O p e r a t i o n E x e c u t o r . j a v a : 110 ) a t o r g . g r a d l e . e x e c u t i o n . t a s k g r a p h . D e f a u l t T a s k G r a p h E x e c u t e r 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 RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)atorg.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)atorg.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)atorg.gradle.execution.taskgraph.DefaultTaskGraphExecuterEventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter E v e n t F i r i n g T a s k W o r k e r . e x e c u t e ( D e f a u l t T a s k G r a p h E x e c u t e r . j a v a : 238 ) a t o r g . g r a d l e . e x e c u t i o n . t a s k g r a p h . D e f a u l t T a s k P l a n E x e c u t o r EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)atorg.gradle.execution.taskgraph.DefaultTaskPlanExecutorTaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access 200 ( D e f a u l t T a s k P l a n E x e c u t o r . j a v a : 79 ) a t o r g . g r a d l e . e x e c u t i o n . t a s k g r a p h . D e f a u l t T a s k P l a n E x e c u t o r 200(DefaultTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor 200(DefaultTaskPlanExecutor.java:79)atorg.gradle.execution.taskgraph.DefaultTaskPlanExecutorTaskExecutorWorker 1. e x e c u t e ( D e f a u l t T a s k P l a n E x e c u t o r . j a v a : 104 ) a t o r g . g r a d l e . e x e c u t i o n . t a s k g r a p h . D e f a u l t T a s k P l a n E x e c u t o r 1.execute(DefaultTaskPlanExecutor.java:104) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor 1.execute(DefaultTaskPlanExecutor.java:104)atorg.gradle.execution.taskgraph.DefaultTaskPlanExecutorTaskExecutorWorker 1. e x e c u t e ( D e f a u l t T a s k P l a n E x e c u t o r . j a v a : 98 ) a t o r g . g r a d l e . e x e c u t i o n . t a s k g r a p h . D e f a u l t T a s k E x e c u t i o n P l a n . e x e c u t e ( D e f a u l t T a s k E x e c u t i o n P l a n . j a v a : 663 ) a t o r g . g r a d l e . e x e c u t i o n . t a s k g r a p h . D e f a u l t T a s k E x e c u t i o n P l a n . e x e c u t e W i t h T a s k ( D e f a u l t T a s k E x e c u t i o n P l a n . j a v a : 597 ) a t o r g . g r a d l e . e x e c u t i o n . t a s k g r a p h . D e f a u l t T a s k P l a n E x e c u t o r 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 1.execute(DefaultTaskPlanExecutor.java:98)atorg.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)atorg.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)atorg.gradle.execution.taskgraph.DefaultTaskPlanExecutorTaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl 1. r u n ( M a n a g e d E x e c u t o r I m p l . j a v a : 46 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r . r u n W o r k e r ( T h r e a d P o o l E x e c u t o r . j a v a : 1142 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r 1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor 1.run(ManagedExecutorImpl.java:46)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl M a n a g e d T h r e a d R u n n a b l e . r u n ( T h r e a d F a c t o r y I m p l . j a v a : 55 ) a t j a v a . l a n g . T h r e a d . r u n ( T h r e a d . j a v a : 745 ) C a u s e d b y : o r g . g r a d l e . a p i . G r a d l e E x c e p t i o n : C o m p i l a t i o n e r r o r . S e e l o g f o r m o r e d e t a i l s a t o r g . j e t b r a i n s . k o t l i n . g r a d l e . t a s k s . T a s k s U t i l s K t . t h r o w G r a d l e E x c e p t i o n I f E r r o r ( t a s k s U t i l s . k t : 16 ) a t o r g . j e t b r a i n s . k o t l i n . g r a d l e . t a s k s . K o t l i n C o m p i l e . p r o c e s s C o m p i l e r E x i t C o d e ( T a s k s . k t : 441 ) a t o r g . j e t b r a i n s . k o t l i n . g r a d l e . t a s k s . K o t l i n C o m p i l e . c a l l C o m p i l e r ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:745) Caused by: org.gradle.api.GradleException: Compilation error. See log for more details at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:16) at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.processCompilerExitCode(Tasks.kt:441) at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)atjava.lang.Thread.run(Thread.java:745)Causedby:org.gradle.api.GradleException:Compilationerror.Seelogformoredetailsatorg.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:16)atorg.jetbrains.kotlin.gradle.tasks.KotlinCompile.processCompilerExitCode(Tasks.kt:441)atorg.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerkotlin_gradle_plugin(Tasks.kt:403)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:297)
at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
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. r u n ( E x e c u t e A c t i o n s T a s k E x e c u t e r . j a v a : 124 ) a t o r g . g r a d l e . i n t e r n a l . p r o g r e s s . D e f a u l t B u i l d O p e r a t i o n E x e c u t o r 1.run(ExecuteActionsTaskExecuter.java:124) at org.gradle.internal.progress.DefaultBuildOperationExecutor 1.run(ExecuteActionsTaskExecuter.java:124)atorg.gradle.internal.progress.DefaultBuildOperationExecutorRunnableBuildOperationWorker.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
解析:编译kotlin项目的时候报以上错误基本上是 kotlin代码有错误引起的,有时候在升级AS版本,升级开发环境时也会出现,哪怕之前是正常的。只要我们找到错误的地方改正过来就好了,但从打印的错误日志中我们找不到错误位置怎么办?
解决方法:
1、点击右侧栏gradle标签;
2、选择 :app——build—— assembleDebug(我这里是选择assembleDefault_channel,Default_channel是项目渠道名称)
3、然后底部的Run标签里 可以看到打印的错误日志,从中可以找到代码错误的位置。