# Build an API with Kotlin on Google Cloud Platform | raywenderlich.com

**URL:** <https://forums.kodeco.com/t/build-an-api-with-kotlin-on-google-cloud-platform-raywenderlich-com/83434>\
**Category:** 🎓 Courses & Articles\
**Created:** [October 1, 2019, 12:48am UTC](https://forums.kodeco.com/t/build-an-api-with-kotlin-on-google-cloud-platform-raywenderlich-com/83434 "2019-10-01T00:48:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pablisco](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pablisco/32/99956_2.png) [@pablisco](https://forums.kodeco.com/u/pablisco)\
**Post date:** [October 1, 2019, 12:48am UTC](https://forums.kodeco.com/t/build-an-api-with-kotlin-on-google-cloud-platform-raywenderlich-com/83434/1 "2019-10-01T00:48:28Z")

</div>

In this tutorial you will learn how to build a server side API using Kotlin and Ktor that you can host on Google Cloud Platform and use with your Android app.

* * *
This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/4656683-build-an-api-with-kotlin-on-google-cloud-platform](https://www.raywenderlich.com/4656683-build-an-api-with-kotlin-on-google-cloud-platform)

---

<div class="post-metadata">

**Author:** ![anklinuxboy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/anklinuxboy/32/81494_2.png) [@anklinuxboy](https://forums.kodeco.com/u/anklinuxboy)\
**Post date:** [October 6, 2019, 7:04pm UTC](https://forums.kodeco.com/t/build-an-api-with-kotlin-on-google-cloud-platform-raywenderlich-com/83434/2 "2019-10-06T19:04:33Z")

</div>

When I try to open the Ray-Conf-Starter project in IntelliJ/Android Studio and run ./gradlew appengineRun, I get an error -  
_Unresolved reference - kotlinx_  
What should I do?

---

<div class="post-metadata">

**Author:** ![anklinuxboy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/anklinuxboy/32/81494_2.png) [@anklinuxboy](https://forums.kodeco.com/u/anklinuxboy)\
**Post date:** [October 6, 2019, 7:11pm UTC](https://forums.kodeco.com/t/build-an-api-with-kotlin-on-google-cloud-platform-raywenderlich-com/83434/3 "2019-10-06T19:11:06Z")

</div>

Looks like @Serializable was already added to the AgendaEntry class in the starter project. All I needed to do was to add the gradle plugin and dependencies. You should move the block to add the gradle dependencies at the top or include them in the starter project

---

<div class="post-metadata">

**Author:** ![rmatze](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rmatze/32/81494_2.png) [@rmatze](https://forums.kodeco.com/u/rmatze)\
**Post date:** [October 8, 2019, 9:49pm UTC](https://forums.kodeco.com/t/build-an-api-with-kotlin-on-google-cloud-platform-raywenderlich-com/83434/4 "2019-10-08T21:49:25Z")

</div>

I’m also trying to execute appengineRun using the finished project and I’m getting an exception. I can’t clearly see what’s causing the exception . Thanks

```
> Task :server:appengineRun FAILED
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.appengine.tools.development.StreamHandlerFactory (file:/Users/A076766/Library/Application%20Support/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java/lib/impl/appengine-local-runtime.jar) to method java.net.URL.getURLStreamHandler(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.google.appengine.tools.development.StreamHandlerFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.NullPointerException
        at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
        at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
        at java.base/java.util.Properties.put(Properties.java:1316)
        at java.base/java.util.Collections$CheckedMap.put(Collections.java:3636)
        at com.google.appengine.tools.development.SharedMain.setTimeZone(SharedMain.java:219)
        at com.google.appengine.tools.development.SharedMain.postServerActions(SharedMain.java:188)
        at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:398)
        at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45)
        at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:257)
        at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':server:appengineRun'.
> com.google.cloud.tools.appengine.AppEngineException: com.google.cloud.tools.appengine.operations.cloudsdk.process.ProcessHandlerException: com.google.cloud.tools.appengine.AppEngineException: Non zero exit: 1

```

---

<div class="post-metadata">

**Author:** ![pablisco](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pablisco/32/99956_2.png) [@pablisco](https://forums.kodeco.com/u/pablisco)\
**Post date:** [October 8, 2019, 11:05pm UTC](https://forums.kodeco.com/t/build-an-api-with-kotlin-on-google-cloud-platform-raywenderlich-com/83434/5 "2019-10-08T23:05:47Z")

</div>

Hi Rmatze,

What you mention can sometimes occur when using a local Java SDK that is higher than the one used in the application.

Here is an example of a similar situation:

> <https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/3514#issuecomment-520381422>
>
> \<!--
> Before reporting a possible bug:
> 
> 1. Please ensure you are running the l…atest version of CT4E with \_Help \> Check for Updates\_
> 2. If the problem occurs when you deploy or after the application has been deployed, try deploying from the command line using gcloud or Maven. If the problem does not go away, then the issue is likely not with Cloud Tools for Eclipse.
> \--\>
> \- Cloud Tools for Eclipse version: 1.8.0.201901101851
> \- Google Cloud SDK version: 250.0.0 (non-managed)
> \- Eclipse version: 4.12.0.v20190605-1800
> \- OS: Windows 10 10.0
> \- Java version: 12.0.1
> 
> \*\*I tried to run the app on app-engine\*\*
> 
> \*\*Expected - A working app\*\*
> 
> \*\*Reality - Server unable to start\*\*
> 
> 
> 
> !\[image\](https://user-images.githubusercontent.com/29875835/62845547-7ac8f100-bce6-11e9-8ee7-e64d9552dd1b.png)
> 
> 
> Stacktrace
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by com.google.appengine.tools.development.StreamHandlerFactory (file:/C:/Users/HP/AppData/Local/Google/Cloud%20SDK/google-cloud-sdk/platform/google\_appengine/google/appengine/tools/java/lib/impl/appengine-local-runtime.jar) to method java.net.URL.getURLStreamHandler(java.lang.String)
> WARNING: Please consider reporting this to the maintainers of com.google.appengine.tools.development.StreamHandlerFactory
> WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
> WARNING: All illegal access operations will be denied in a future release
> Aug 12, 2019 9:49:03 AM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
> INFO: Overwriting system property key 'java.util.logging.config.file', value 'C:\\Users\\HP\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\google\_appengine\\google\\appengine\\tools\\java\\config\\sdk\\logging.properties' with value 'WEB-INF/logging.properties' from 'D:\\Mathan\\Eclipse Workspace For AppEngine\\.metadata\\.plugins\\org.eclipse.wst.server.core\\tmp2\\DummyProject\\WEB-INF\\appengine-web.xml'
> java.lang.NullPointerException
> at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
> at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
> at java.base/java.util.Properties.put(Properties.java:1316)
> at java.base/java.util.Collections$CheckedMap.put(Collections.java:3636)
> at com.google.appengine.tools.development.SharedMain.setTimeZone(SharedMain.java:219)
> at com.google.appengine.tools.development.SharedMain.postServerActions(SharedMain.java:188)
> at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:398)
> at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45)
> at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:257)
> at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248)

Java 9 introduced restrictions when accessing resources across packages.

> **[How Java 9 And Project Jigsaw May Break Your Code // nipafx](https://nipafx.dev/how-java-9-and-project-jigsaw-may-break-your-code/)**
>
> With Java 9 comes Project Jigsaw - a modularization of the JDK - which will break existing code. An overview over the planned changes lets you see whether yours is affected.

Such restriction means that if an SDK is using `setAccessible` for a class on a separate package, then you get the error that you’ve reported.

Google makes use of reflexion in their AppEngine SDK, and therefore, we are forced to use Java 8 for now. I imagine that they’ll update bit in the future.

If you are in this situation, you have to downgrade the local Java SDK to be 8. Such downgrade may not be desirable if you have other projects that rely on newer versions of Java. On the other hand, if you are an Android developer, there is only support for Java 8, so it’s safe to downgrade. Maybe one day we can upgrade :]

If you want to switch versions quickly or to have an easier downgrade, sdkman is a great tool

Let me know if it works for you.

---

<div class="post-metadata">

**Author:** ![rmatze](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rmatze/32/81494_2.png) [@rmatze](https://forums.kodeco.com/u/rmatze)\
**Post date:** [October 9, 2019, 2:31pm UTC](https://forums.kodeco.com/t/build-an-api-with-kotlin-on-google-cloud-platform-raywenderlich-com/83434/6 "2019-10-09T14:31:55Z")

</div>

Hi,

I’ll give it a whirl. Thanks for the quick response!

Update: Using sdkman to downgrade my java version worked as you suggested. Thanks again!
