How to build and run Traccar in Android Studio from source?

Oleg9 years ago

I have downloaded source code of Traccar. and tried to build it and run in Android Studio. I did import of new project from Menu.

After that I saw project files in left menu of Android Studio. I can not run this project because when I choose Android Emulator Device or create a new device, but it does not work.

How to build and run Traccar in Android Studio from source?

Android Studio 2.1.1

Anton Tananaev9 years ago

What is "import of new project"? There is either "import project" or "create new project"? Which one did you use?

Also, what error(s) do you see when you run the project?

koen8 years ago

I'm also unable to build the Android client in Android Studio. This is the error I receive:

$ adb shell am start -n "org.traccar.client.hidden/org.traccar.client.Launcher" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "org.traccar.client.hidden/org.traccar.client.Launcher" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=org.traccar.client.hidden/org.traccar.client.Launcher }
Error type 3
Error: Activity class {org.traccar.client.hidden/org.traccar.client.Launcher} does not exist.

Error while Launching activity
Anton Tananaev8 years ago

@koen, you are building hidden version. That's intended behavior for hidden app.

If you want to build regular version, you need to change Build Variant in Android Studio.

koen8 years ago

Thanks,

works now!

surafel worku5 years ago

there is an error

 Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom'.

when I import source code what is the problem?

Przemyslaw5 years ago

Hello @Anton Tananaev, I have traccar server on my VPS, now I want to enable push notifications on my android smartphone. I register new firebase project, I download Traccar Manager from github but I cannot find any info what to do next. I don't know what to do in Android Studio. Is there any tutorial?
Regards,
Przemek

Anton Tananaev5 years ago

Firebase website has some documentation. Basically you need to provide google-services.json and the build correct "google" flavor. Check our gradle file to understand it better as well.

Przemyslaw5 years ago

@Anton Tananaev, thank You very much for fast response. I'm not programer so forgive me. I start new project on Firebase and set name org.traccar.manager and set my personal pseudo GPS-Przemko. Then I open android studio and add Traccar-manager-android to it. Next I add google-services.json file to it. I sync everything. Can You tell me what I need to do next? Only add:

<entry key='notificator.types'>web,mail,firebase</entry>
<entry key='notificator.firebase.key'>FIREBASE_SERVER_KEY</entry>

or do I have to do something more?

Anton Tananaev5 years ago

If you are not familiar with Android development, there are plenty of resources out there to learn.

Przemyslaw5 years ago

@Anton Tananaev can You tell me do I have to change my traccar manager app name? When I buil app in Android Studio I have name: "app.regular.release.apk". Change it to: "org.traccar.manager"? What steps I have to do after that in Traccar Manager?