-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove inline css to use browser cache instead
- Loading branch information
Showing
10 changed files
with
55 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
**.frag.html | ||
**.plain.html | ||
**.max.html | ||
**.css | ||
**.frag.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
<!doctype html><meta charset=utf-8><title>make android-kotlin-migration.html</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><h1 id=manually-migrating-an-android-project-to-kotlin>Manually migrating an Android project to Kotlin</h1><p>Kotlin is now officialy <a href=https://developer.android.com/kotlin/index.html>Kotlin and Android</a>, and as such I wanted to give it another try. There are of course tutorials <a href=https://kotlinlang.org/docs/tutorials/kotlin-android.html>out there</a>, but they all aim users of Android Studio. Let's see how we can do without.<p>First things first, let's add Kotlin to our build script. We need to add to the <code>build.gradle</code> of our application three things:<ul><li>the repository where Kotlin is found,<li>the dependency to the build tools for Kotlin,<li>the runtime dependencies for our project.</ul><div class=sourceCode><pre class="sourceCode diff"><code class="sourceCode diff">buildscript { | ||
<span class=va>+ repositories {</span> | ||
<span class=va>+ jcenter()</span> | ||
<span class=va>+ mavenCentral()</span> | ||
<span class=va>+ }</span> | ||
<span class=va>+ dependencies {</span> | ||
<span class=va>+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2"</span> | ||
<span class=va>+ }</span> | ||
<span class=va>+}</span> | ||
<span class=va>+</span> | ||
apply plugin: 'com.android.application' | ||
<span class=va>+apply plugin: 'kotlin-android'</span> | ||
<span class=va>+apply plugin: 'kotlin-android-extensions'</span></code></pre></div><div class=sourceCode><pre class="sourceCode diff"><code class="sourceCode diff"> dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.android.support:design:23.1.1' | ||
<span class=va>+</span> | ||
<span class=va>+ compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2'</span> | ||
<span class=va>+ testCompile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2'</span> | ||
}</code></pre></div><p>If we run our <code>gradlew</code> script, we can see that it is installing the Kotlkin toolchain, but that no Kotlin code is built. Of course, because there are none yet.<p>Kotlin developers provide an <a href=https://try.kotlinlang.org/ >online Java-to-Kotlkin transpiler</a>. It is far from perfect, but it is enough for beginers with an existing Java project. In our application source directory, we create the same architecture where we replace <code>src/main/java/<package></code> with <code>src/main/kotlin/<package></code>. We transpile all the <code>.java</code> files to <code>.kt</code> and we run again our <code>gradlew</code> script.<p>Voilà. | ||
<!doctype html><meta charset=utf-8><title>make</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><link href=style.css rel=stylesheet><h1 id=manually-migrating-an-android-project-to-kotlin>Manually migrating an Android project to Kotlin</h1><p>Kotlin is now officialy <a href=https://developer.android.com/kotlin/index.html>Kotlin and Android</a>, and as such I wanted to give it another try. There are of course tutorials <a href=https://kotlinlang.org/docs/tutorials/kotlin-android.html>out there</a>, but they all aim users of Android Studio. Let’s see how we can do without.<p>First things first, let’s add Kotlin to our build script. We need to add to the <code>build.gradle</code> of our application three things:<ul><li>the repository where Kotlin is found,<li>the dependency to the build tools for Kotlin,<li>the runtime dependencies for our project.</ul><div class=sourceCode id=cb1><pre class="sourceCode diff"><code class="sourceCode diff"><a class=sourceLine data-line-number=1 id=cb1-1>buildscript {</a> | ||
<a class=sourceLine data-line-number=2 id=cb1-2><span class=va>+ repositories {</span></a> | ||
<a class=sourceLine data-line-number=3 id=cb1-3><span class=va>+ jcenter()</span></a> | ||
<a class=sourceLine data-line-number=4 id=cb1-4><span class=va>+ mavenCentral()</span></a> | ||
<a class=sourceLine data-line-number=5 id=cb1-5><span class=va>+ }</span></a> | ||
<a class=sourceLine data-line-number=6 id=cb1-6><span class=va>+ dependencies {</span></a> | ||
<a class=sourceLine data-line-number=7 id=cb1-7><span class=va>+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2"</span></a> | ||
<a class=sourceLine data-line-number=8 id=cb1-8><span class=va>+ }</span></a> | ||
<a class=sourceLine data-line-number=9 id=cb1-9><span class=va>+}</span></a> | ||
<a class=sourceLine data-line-number=10 id=cb1-10><span class=va>+</span></a> | ||
<a class=sourceLine data-line-number=11 id=cb1-11> apply plugin: 'com.android.application'</a> | ||
<a class=sourceLine data-line-number=12 id=cb1-12><span class=va>+apply plugin: 'kotlin-android'</span></a> | ||
<a class=sourceLine data-line-number=13 id=cb1-13><span class=va>+apply plugin: 'kotlin-android-extensions'</span></a></code></pre></div><div class=sourceCode id=cb2><pre class="sourceCode diff"><code class="sourceCode diff"><a class=sourceLine data-line-number=1 id=cb2-1> dependencies {</a> | ||
<a class=sourceLine data-line-number=2 id=cb2-2> compile fileTree(dir: 'libs', include: ['*.jar'])</a> | ||
<a class=sourceLine data-line-number=3 id=cb2-3> compile 'com.android.support:design:23.1.1'</a> | ||
<a class=sourceLine data-line-number=4 id=cb2-4><span class=va>+</span></a> | ||
<a class=sourceLine data-line-number=5 id=cb2-5><span class=va>+ compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2'</span></a> | ||
<a class=sourceLine data-line-number=6 id=cb2-6><span class=va>+ testCompile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2'</span></a> | ||
<a class=sourceLine data-line-number=7 id=cb2-7> }</a></code></pre></div><p>If we run our <code>gradlew</code> script, we can see that it is installing the Kotlkin toolchain, but that no Kotlin code is built. Of course, because there are none yet.<p>Kotlin developers provide an <a href=https://try.kotlinlang.org/ >online Java-to-Kotlkin transpiler</a>. It is far from perfect, but it is enough for beginers with an existing Java project. In our application source directory, we create the same architecture where we replace <code>src/main/java/<package></code> with <code>src/main/kotlin/<package></code>. We transpile all the <code>.java</code> files to <code>.kt</code> and we run again our <code>gradlew</code> script.<p>Voilà. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!doctype html><meta charset=utf-8><title>make android-sdk-install.html</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><h1 id=android-headless-sdk-installation>Android <em>headless</em> SDK installation</h1><p>I wanted to install <em>Android SDK</em> without installing this ugly IDE. The main goal was to rebuild existing projects, so I didn't need something as heavy. The main difficulty came when I downloaded the actual sdk, and receive the following message from Google.<blockquote><p>Because you've downloaded the command line tools (not Android Studio), there are no install instructions.</blockquote><p>First things first. The SDK can be easily found on the download page of the Android developer website. Hidden at the end of the page in a section named <em><a href=https://developer.android.com/studio/index.html#command-tools>Get just the command line tools</a></em>.<p>We download a <code>.zip</code> file, because it's to complicated to provide a tarball, and unzip it somewhere, preferably <code>~/.android</code>.<p>Then we update your <code>~/.profile</code>, or wherever we put your env to include the following lines <em>mutatis mutandis</em> and reload our session.<div class=sourceCode><pre class="sourceCode bash"><code class="sourceCode bash"><span class=bu>export</span> <span class=va>ANDROID_HOME=</span><span class=st>"</span><span class=va>$HOME</span><span class=st>/.android"</span> | ||
<span class=bu>export</span> <span class=va>PATH=</span><span class=st>"</span><span class=va>$ANDROID_HOME</span><span class=st>/tools:</span><span class=va>$ANDROID_HOME</span><span class=st>/tools/bin:</span><span class=va>$ANDROID_HOME</span><span class=st>/platform-tools:</span><span class=va>$PATH</span><span class=st>"</span></code></pre></div><p>Once we're here, the installation is straightforward once we now which command to run.<div class=sourceCode><pre class="sourceCode bash"><code class="sourceCode bash"><span class=ex>android</span> update sdk</code></pre></div><p>Then we must install some build tools.<div class=sourceCode><pre class="sourceCode bash"><code class="sourceCode bash"><span class=ex>sdkmanager</span> <span class=st>"platforms;android-23"</span> | ||
<span class=ex>sdkmanager</span> <span class=st>"build-tools;23.0.1"</span></code></pre></div><p>And also we must not forget to install all those <code>compat</code> libraries.<div class=sourceCode><pre class="sourceCode bash"><code class="sourceCode bash"><span class=ex>sdkmanager</span> <span class=st>"extras;android;m2repository"</span></code></pre></div><p>And <em>voilà</em>! | ||
<!doctype html><meta charset=utf-8><title>make</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><link href=style.css rel=stylesheet><h1 id=android-headless-sdk-installation>Android <em>headless</em> SDK installation</h1><p>I wanted to install <em>Android SDK</em> without installing this ugly IDE. The main goal was to rebuild existing projects, so I didn’t need something as heavy. The main difficulty came when I downloaded the actual sdk, and receive the following message from Google.<blockquote><p>Because you’ve downloaded the command line tools (not Android Studio), there are no install instructions.</blockquote><p>First things first. The SDK can be easily found on the download page of the Android developer website. Hidden at the end of the page in a section named <em><a href=https://developer.android.com/studio/index.html#command-tools>Get just the command line tools</a></em>.<p>We download a <code>.zip</code> file, because it’s to complicated to provide a tarball, and unzip it somewhere, preferably <code>~/.android</code>.<p>Then we update your <code>~/.profile</code>, or wherever we put your env to include the following lines <em>mutatis mutandis</em> and reload our session.<div class=sourceCode id=cb1><pre class="sourceCode bash"><code class="sourceCode bash"><a class=sourceLine data-line-number=1 id=cb1-1><span class=bu>export</span> <span class=va>ANDROID_HOME=</span><span class=st>"</span><span class=va>$HOME</span><span class=st>/.android"</span></a> | ||
<a class=sourceLine data-line-number=2 id=cb1-2><span class=bu>export</span> <span class=va>PATH=</span><span class=st>"</span><span class=va>$ANDROID_HOME</span><span class=st>/tools:</span><span class=va>$ANDROID_HOME</span><span class=st>/tools/bin:</span><span class=va>$ANDROID_HOME</span><span class=st>/platform-tools:</span><span class=va>$PATH</span><span class=st>"</span></a></code></pre></div><p>Once we’re here, the installation is straightforward once we now which command to run.<div class=sourceCode id=cb2><pre class="sourceCode bash"><code class="sourceCode bash"><a class=sourceLine data-line-number=1 id=cb2-1><span class=ex>android</span> update sdk</a></code></pre></div><p>Then we must install some build tools.<div class=sourceCode id=cb3><pre class="sourceCode bash"><code class="sourceCode bash"><a class=sourceLine data-line-number=1 id=cb3-1><span class=ex>sdkmanager</span> <span class=st>"platforms;android-23"</span></a> | ||
<a class=sourceLine data-line-number=2 id=cb3-2><span class=ex>sdkmanager</span> <span class=st>"build-tools;23.0.1"</span></a></code></pre></div><p>And also we must not forget to install all those <code>compat</code> libraries.<div class=sourceCode id=cb4><pre class="sourceCode bash"><code class="sourceCode bash"><a class=sourceLine data-line-number=1 id=cb4-1><span class=ex>sdkmanager</span> <span class=st>"extras;android;m2repository"</span></a></code></pre></div><p>And <em>voilà</em>! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.