记录Android-Studio遇到的各种坑

开此文章,主要是为了记录在使用虐我千百遍,我还待他如初恋的AS的过程中所遇到的各种坑,一来是希望做个记录,方便查找,防止再次踏入同样的坑;二来也希望能帮助到有遇到有跟我相同问题的人。

1,首先每次导入一个新的AS工程的时候,肯定会有各种gradle配置问题,只要把build.gradle改为与自己系统相匹配即可,如果报

Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "f3cec24ce64772515843ff5f88a0005c31cdbe71"
 

把project的build.gradle里面的2.0.0-alpha3改为 1.5.0 即可

E:\android-studio-2.0-preview4\android-studio\gradle\m2repository\com\android\tools\build\gradle

这个目录下面有当前安装的版本,都可以试试

再把其他build.gradle里面的 compileSdkVersion 和  buildToolsVersion  和  依赖的support包版本改为自己常用的版本一般就可正常调试了。
 

2,如果在下载程序的时候,报了以下错误

Error:Could not create the Java Virtual Machine. Invalid maximum heap size:4g

这个错误我找了很久,最后还是在万能的stackoverflow里找到了答案,其实就是项目的build.gradle被配置了

 

dexOptions {
    incremental true
    javaMaxHeapSize "4g"
}

把4g 改为1024m问题解决

 

 

 

3,快速将一个项目转换为lib项目:

①   修改build.gradle,把  applyplugin:'com.android.application'改为applyplugin:'com.android.library'

然后去掉 defaultConfig里面的applicationId

②   清空AndroidManifest里面的内容留下最外层manifest即可,如下:

 
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="***">
</manifest>

 

 

 

 

4,AS项目的包名是在build.gradle文件里面的applicationId配置的,在mainfest配置将不生效。

 

5,eclipse项目转为android studio : 在eclipse中Export,导出gradle项目,选择需要导出的项目及libProject,随便找个正常的as工程的gradle文件夹,覆盖刚刚导出项目的gradle文件夹,然后根据 1 进行配置即可。(注:导出的项目会覆盖原工程使得此项目可以同时在eclipse和android studio中使用,as比ec检测严格,会检测到所有重复的资源,权限,假冒的.9,jar,以及中文乱码,根据对应提示进行删除)

 

6,大坑:

Warning:Ignoring InnerClasses attribute for an anonymous inner class
(com.tencent.mm.sdk.b.b) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
Warning:Ignoring InnerClasses attribute for an anonymous inner class
(com.tencent.mm.sdk.openapi.WXApiImplV10$ActivityLifecycleCb$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
UNEXPECTED TOP-LEVEL ERROR:
Error:Execution failed for task ':DLNA_DMC:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_73\bin\java.exe'' finished with non-zero exit value 3

出现类型警告和错误,那么jar重复,没有用到的jar,jar里面的包名与xxx的包名重复,或者是jar版本太老等,反正是jar里面的class文件转为dex的时候出错,解决办法是删除jar包,网上找对应的源码,或者用工具把jar转为源码形式来调用解决掉所有警告,然后加上multidex处理65536的问题,因为方法越界也会出现类似此错误,完了即可编译通过。。

 

 

7,类似如下错误

> Duplicate files copied in APK META-INF/NOTICE.txt
    File 1: F:\android_studio_project\nizaoma\app\libs\httpmime-4.2.4.jar
    File 2: F:\android_studio_project\nizaoma\app\libs\httpmime-4.2.4.jarDuplicate files copied in APK META-INF/NOTICE.txt
    File 1: F:\android_studio_project\nizaoma\app\libs\httpmime-4.2.4.jar
    File 2: F:\android_studio_project\nizaoma\app\libs\httpmime-4.2.4.jar

build.gradle android{}里添加:
packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
}

 

 

8,出现-Xmx128m -Xmx512m -Xmx1024m类似字样的错误,在.gradle的gradle.properties添加一项 org.gradle.jvmargs=-Xmx512m,若无此文件,则新建

 

 

9,as正确导入和删除module方式:

①  导入:File→New→import module 选中module所在目录,可改名确定即可,打开项目目录可以看到已经自动把module复制到目录中,所以无需手动复制module到项目目录,否则导入时会报已经存在一个同名的project的错误

②  删除:File→Project Structure 选中需要删除的module 点击“—”,确定回到项目目录找到要删除的module右键删除即可

 

 

10.报错 :/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libgotyeapi.so"

原因是在64位手机上会自动寻找jni里面arm64-v8a文件夹里面的so文件,如果找不到则报这个错误,如果把32位的so放进去则报位数不匹配的错误,解决方法是放入64位的so或者删除该文件夹,只留armeabi,然后在配置

 

如果在添加“abiFilter”之后Android Studio出现以下提示:

NDK integration is deprecated in the current plugin. Consider trying the new experimental plugin.

则在项目根目录的gradle.properties文件中添加:

android.useDeprecatedNdk=true

 

 

 

 

11. debug - unaligned .apk 无法删除,as每次编译的时候需要更新build文件,如果无法删除build里面的文件,那么编译将会报错,遇到这种情况,其实不管你是直接在文件夹,还是在as里面删除build,或者直接用第三方粉碎文件都是删除不了的,此时需重启,完成之后你会发现文件已经被删除,所以重启可解决此文件错乱的问题。若重启也删除不了那么把此项目复制,debug - unaligned .apk会提示无法复制,跳过,然后再打开即可 ,经查,这是金山毒霸搞得鬼,卸载可根除此问题

 

12.一个开发过程中比较少遇到的错误:java.lang.NoSuchFieldError: ***R$id***

造成此问题的原因在于库文件的xml与主文件的xml同名了,作修改即可

 

13.终于我也更新了AS2.1stable版本,据说其Instant Run功能可以大大提高编译速度,RunDebug的时候,只有在第一次build会花费大量的时间,之后再次Run或者Debug的时候会直接把变化的代码更新到手机,再上面生成一个新的APK直接运行,这样就能很快的显示出更改代码之后的变化,加快了开发效率和调试效率。当我怀着期待的心情更新了gradle为2.1,然后run了一下项目,既遭提示:

 

Instant Run is disabled: Instant Run does not support deploying build variants with multidex enabled, to a targetwith API level 20 or below. To use Instant Run with a multidex enabled build variant, deploy to a target with API level 21 or higher.

经查,当项目开启了multidex,Instant Run需要在5.0手机(既是minSdkVersion是21以上)才能正常使用。

 

14.

出现如下错误:

 

解决方法:

dexOptions {
    javaMaxHeapSize"5120"
    preDexLibraries =false
}

 

15.出现如下错误:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

>com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:

java.lang.OutOfMemoryError: GC overhead limit exceeded

解决方法:

在.gradle的gradle.properties的 org.gradle.jvmargs=-Xmx512m调大点,我的调为4g即可,若无此文件,则新建

 

16.出现如下错误:

Error:trouble processing "java/lang/AutoCloseable.class":

Error:Ill-advised or mistaken usage of a core class (java.* or javax.*)

Error:when not building a core library.

Error:This is often due to inadvertently including a core library file

Error:in your application's project, when using an IDE (such as

Error:Eclipse). If you are sure you're not intentionally defining a

Error:core class, then this is the most likely explanation of what's

Error:going on.

Error:However, you might actually be trying to define a class in a core

Error:namespace, the source of which you may have taken, for example,

Error:from a non-Android virtual machine project. This will most

Error:assuredly not work. At a minimum, it jeopardizes the

Error:compatibility of your app with future versions of the platform.

Error:It is also often of questionable legality.

原因是项目中引用了以java开头包名的代码,jar里的包名也算,修改包名即可

 

17.有些项目还是用到eclipse的,每次用eclipse新开一个workspace的时候应该先调环境:

①,设置主题:

②,颜色主题:

3,设置代码提示:

④,设置字体大小

⑤,设置logcat字体颜色

 

18:zip file is empty:

一般你删除了jar包 撤回的时候会造成此问题,重新把有效的jar包覆盖进去即可解决此问题

 

19:文件编码问题,报如下错误:

Error:(23, 48) 閿欒: 缂栫爜UTF-8鐨勪笉鍙槧灏勫瓧绗?
Error:(23, 49) 閿欒: 缂栫爜UTF-8鐨勪笉鍙槧灏勫瓧绗?
Error:(23, 50) 閿欒: 缂栫爜UTF-8鐨勪笉鍙槧灏勫瓧绗?
Error:(23, 51) 閿欒: 缂栫爜UTF-8鐨勪笉鍙槧灏勫瓧绗?

 

错误文件比较少的话可以手动复制内容过去即可解决问题,如果错误文件比较多需要批量转换请移至以下文章

http://blog.csdn.net/u012874222/article/details/77367464

 

 

 

20:INSTALL_FAILED_TEST_ONLY

 

升级到AS3.0后,每次调试生成debug包MainFest的Application标签自带testOnly=true属性,即使你没在MainFest里设置此项,导致将此APK复制出来安装会报此错误,解决方法就是通过Gradle里的build来生成,如下图

 

21:

 Error:Could not create service of type FileCollectionSnapshotterRegistry using TaskExecutionServices.createFileCollectionSnapshotterRegistry().
> Could not create service of type CachingFileHasher using TaskExecutionServices.createFileSnapshotter(). 

解决方法:删除项目根目录下的.gradle文件夹即可

 

22:如何利用AS创建Java项目?

首先AS默认没有创建Java项目的选项,所以直接创建一个Android项目,然后把项目转为Java即可,那怎么转呢?经过以下两个步骤即可实现:

①Android项目的build.gradle(非根目录的build.gradle)改为如下:

 

apply plugin: 'java'

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
}

sourceCompatibility = "1.7"
targetCompatibility = "1.7"

②删除一些文件和文件夹,然后创建一个Java文件即可运行调试,最终文件结构如下

23、AS打Jar包(在对应的build.gradle下添加如下代码):

①java工程:

task makeJar(type: Jar, dependsOn: ['build']) {
    archiveName = 'mtapm-inject.jar'//生成的jar包文件名
    from('build/classes/java/main')//需要打包的class文件
    from(project.zipTree("libs/antlr-runtime-3.5.2.jar"))//需要合并的jar
    from(project.zipTree("libs/guava-18.0.jar"))
    from(project.zipTree("libs/support-annotations-25.3.1.jar"))
    from(project.zipTree("libs/SignatureAPI.jar"))
    destinationDir = file('build/libs')//jar文件夹生成路径
    manifest {//配置MAIN-INF
        attributes(
                'Manifest-Version': '1.0',
                'Main-Class': "mt.apm.inject.MtApmInjector")
    }
}

②Android Module工程:

task makeDebugJar(type: Jar, dependsOn: ['bundleDebug']) {//若打包Release,则参数为bundleRelease
    archiveName = 'mtapm_debug.jar'//生成的jar包文件名
    from zipTree('build/intermediates/packaged-classes/debug/classes.jar')//源Jar
    destinationDir = file('build/libs')//jar文件夹生成路径
}

如为混淆打包,需要对应的buildType开启  minifyEnabled true

24、containing both DEX and Java-bytecode content:引入的jar包里除了有class还有dex

治标:gradle.properties添加 android.enableD8=false

治本:重新打jar包

运行android Studio运行出错出错,报错为:这是怎么回事/////////////// ``` 错误:Execution failed for task ':app:buildInfoDebugLoader'. > Exception while loading build-info.xml : org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。 at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) at com.android.utils.XmlUtils.parseUtfXmlFile(XmlUtils.java:514) at com.android.build.gradle.internal.incremental.InstantRunBuildContext.mergeFromFile(InstantRunBuildContext.java:676) at com.android.build.gradle.internal.incremental.BuildInfoLoaderTask.executeAction(BuildInfoLoaderTask.java:72) 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.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141) at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134) at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:632) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:615) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51) 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.execute(DefaultTaskGraphExecuter.java:236) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228) at org.gradle.internal.Transformers$4.transform(Transformers.java:169) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:196) at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:193) at org.gradle.internal.Transformers$4.transform(Transformers.java:169) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:193) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102) at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71) at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:50) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:43) at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:40) at org.gradle.internal.Transformers$4.transform(Transformers.java:169) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56) at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40) at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:75) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75) at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49) at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44) at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) ```
启动报错 求解 ``` Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2019-01-18 16:46:27.462 ERROR 2312 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiController': Unsatisfied dependency expressed through field 'apiService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiService': Unsatisfied dependency expressed through field 'companyMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyMapper' defined in file [F:\javaProjects\app-service\target\classes\com\mapath\bigreward\appservice\mapper\CompanyMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE] at com.mapath.bigreward.appservice.AppServiceApplication.main(AppServiceApplication.java:17) [classes/:na] Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiService': Unsatisfied dependency expressed through field 'companyMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyMapper' defined in file [F:\javaProjects\app-service\target\classes\com\mapath\bigreward\appservice\mapper\CompanyMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] ... 19 common frames omitted Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyMapper' defined in file [F:\javaProjects\app-service\target\classes\com\mapath\bigreward\appservice\mapper\CompanyMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1745) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] ... 32 common frames omitted Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required at org.springframework.util.Assert.notNull(Assert.java:198) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.mybatis.spring.support.SqlSessionDaoSupport.checkDaoConfig(SqlSessionDaoSupport.java:74) ~[mybatis-spring-1.3.2.jar:1.3.2] at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:73) ~[mybatis-spring-1.3.2.jar:1.3.2] at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44) ~[spring-tx-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] ... 42 common frames omitted Disconnected from the target VM, address: '127.0.0.1:51427', transport: 'socket' Process finished with exit code 1 ```
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页