Skip to content

Commit

Permalink
Android example for 0.15.2 (#1027)
Browse files Browse the repository at this point in the history
* android examples: upgrade gradlew

* android examples: upgrade gradle plugin

* increase versions of other tools

* README for android example
  • Loading branch information
radetsky committed Oct 3, 2023
1 parent 9bda981 commit 4193cbc
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 140 deletions.
17 changes: 17 additions & 0 deletions docs/examples/android/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Android example

## Compile
```
./gradlew clean build
```

## Install
```
./gradlew installDebug
```
You should see the empty screen with the message "Hello from themis!" and title "ThemisTestApp".
Also, you may to run `adb logcat | grep SMC` and see something like this:
```agsl
10-03 21:36:57.842 16956 16956 D SMC : encrypted string = AAEBQQwAAAAQAAAADQAAABYAAAASizR1/IPS4UYioLPeH8VpdgvaXl9875aZorAZ/soEABAAa/ARqQwo6liyQrluj06zohARxU/0LBNYb3UvKAc=
10-03 21:36:58.776 16956 16956 D SMC : decrypted data = hello message
```
9 changes: 5 additions & 4 deletions docs/examples/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
compileSdkVersion 33
buildToolsVersion '34.0.0'
defaultConfig {
applicationId "com.cossacklabs.themis.android.example"
minSdkVersion 25
targetSdkVersion 29
targetSdkVersion 33
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand All @@ -20,6 +20,7 @@ android {
}
productFlavors {
}
namespace 'com.cossacklabs.themis.android.example'
}

dependencies {
Expand All @@ -29,7 +30,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
implementation 'com.cossacklabs.com:themis:0.14.0'
implementation 'com.cossacklabs.com:themis:0.15.2'
implementation "androidx.core:core-ktx:1.3.2"
//noinspection GradleDependency: we use slightly outdated "kotlin_version" on purpose
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Expand Down
12 changes: 8 additions & 4 deletions docs/examples/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cossacklabs.themis.android.example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -12,20 +11,25 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivitySecureCell">
<activity android:name=".MainActivitySecureCell"
android:label="@string/app_name"
android:exported="true"> <!-- Specify android:exported attribute with an explicit value -->

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivitySecureMessage">
<activity android:name=".MainActivitySecureMessage"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>

</manifest>
5 changes: 2 additions & 3 deletions docs/examples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
// https://developer.android.com/studio/build/jcenter-migration

buildscript {
ext.kotlin_version = '1.4.32'
ext.kotlin_version = '1.6.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
Binary file modified docs/examples/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 4193cbc

Please sign in to comment.