The idea is extremely powerful and is comparable to Microsoft's universe's first IDE. For a long time, the perfection of its configuration produced almost superstitious feelings. It seems that as long as the normal channel, use it to configure, there is no unsuccessful.
Idea is a powerful tool for developing Android native programs, and Android Studio is based on idea development tools. Androidstudio is capable, and idea is equally capable. Kotlin is a language developed by Jetbrain, called Swift on Android, and perfectly compatible with Java, which is quite promptitude. But in the Kotlin configuration, planted a big somersault.
Introducing Kotlin in Android is simple. Build an Android project first, and then build the Kotlin activity directly. Idea will be very thoughtful to remind you to introduce Kotlin and automatically modify Build.gradle. Everything is fine. Then, the problem comes, the compile time error.
Error:gradle:a problem occurred configuring project ': App '.
> Could not resolve all dependencies for configuration ': App:_debugapkcopy '.
> Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.0.7.
Required by:
KotAnd:app:unspecified
Well, Google half-day, specious Google to, said to find 1.0.7 this jar package, may be the version issue. I'd like to upgrade to the latest version of 1.1.1.
Re-import after the change, and error.
Error:Gradle:Execution failed for task ': App:compiledebugkotlin '.
> compilation error. See Log for more details
Well, I was dumbfounded. Let me see log, I'll go and see log. A pile of errors in the log. The main effect seems to be this message.
Java.io.filenotfoundexception:c:\users\musarona\. Intellijidea2017.1\system\compile-server\kotand_2f6a3daa\gradle\configuration.xml (the system cannot find the path specified.) )
At Java.io.FileInputStream.open0 (Native Method)
At Java.io.FileInputStream.open (fileinputstream.java:195)
At Java.io.fileinputstream.<init> (fileinputstream.java:138)
At Com.intellij.openapi.util.JDOMUtil.load (jdomutil.java:304)
At Org.jetbrains.jps.gradle.model.impl.JpsGradleExtensionServiceImpl.getGradleProjectConfiguration ( JPSGRADLEEXTENSIONSERVICEIMPL.JAVA:125)
At Org.jetbrains.jps.gradle.model.impl.JpsGradleExtensionServiceImpl.getGradleProjectConfiguration ( jpsgradleextensionserviceimpl.java:113)
At Org.jetbrains.jps.gradle.model.impl.GradleResourcesTarget.computeRootDescriptors (Gradleresourcestarget.java : 69)
At Org.jetbrains.jps.builders.impl.BuildRootIndexImpl.addRoots (buildrootindeximpl.java:72)
At Org.jetbrains.jps.builders.impl.buildrootindeximpl.<init> (buildrootindeximpl.java:62)
At Org.jetbrains.jps.cmdline.BuildRunner.load (buildrunner.java:84)
At Org.jetbrains.jps.cmdline.BuildSession.runBuild (buildsession.java:267)
At Org.jetbrains.jps.cmdline.BuildSession.run (buildsession.java:125)
At Org.jetbrains.jps.cmdline.buildmain$mymessagehandler.lambda$channelread0$0 (buildmain.java:236)
At Org.jetbrains.jps.service.impl.sharedthreadpoolimpl.lambda$executeonpooledthread$0 (SharedThreadPoolImpl.java : 42)
At Java.util.concurrent.executors$runnableadapter.call (executors.java:511)
At Java.util.concurrent.FutureTask.run (futuretask.java:266)
At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1142)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:617)
At Java.lang.Thread.run (thread.java:745)
What do you mean, Gradle can't find the path to the configuration file. is Gradle not the global fq, some file download slow problem. OK, open the global FQ, change a few address. is still the same error.
Does 1.1.1 have a problem? OK, change 1.1.0 and so on a few versions of the same.
Is Maven's repo too slow? Change the Aliyun repo, still the same.
Check the problem I want to die, finally found a piece of information, it seems like idea when adding Kotlin, some configuration items are not added. How is that possible? How can this be! This is really the case, the problem is in the idea of adding kotlin when the modification configuration. What do you want me to do to prevent this problem?
A total of two places to be modified, one is the build.gradle of the whole project.
Buildscript {
ext.kotlin_version = ' 1.1.1 '
repositories {
Jcenter ()
}
dependencies {
Classpath ' com.android.tools.build:gradle:2.2.2 '
Classpath "Org.jetbrains.kotlin:kotlin-gradle-plugin: $kotlin _version"
The following line is the configuration that should be added
Classpath "org.jetbrains.kotlin:kotlin-android-extensions: $kotlin _version"
Note:do not place your application dependencies here; They belong
In the individual module Build.gradle files
}
}
The other one is the Build.gradle in the module.
Apply plugin: ' Com.android.application '
Apply plugin: ' Kotlin-android '
Here are the plugin that need to be added manually
Apply plugin: ' Kotlin-android-extensions '
As such a powerful tool, Kotlin is the language of the independent research and development of Jetbrain, make such a problem, really let people unexpectedly. It must be written down that time has been murdered again.
idea to develop Android program configuration summary based on Kotlin