vm-tests: build a sample android app offline in the android-dev archetype
This commit is contained in:
parent
f7f8c208b3
commit
36a8b4fa1f
7 changed files with 235 additions and 10 deletions
17
nix/vm-tests/android-dev-sample/build.gradle
Normal file
17
nix/vm-tests/android-dev-sample/build.gradle
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
plugins {
|
||||
id 'com.android.application' version '8.13.0'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = 'test.hyperhive.sample'
|
||||
compileSdk = 35
|
||||
buildToolsVersion = '36.1.0'
|
||||
|
||||
defaultConfig {
|
||||
applicationId = 'test.hyperhive.sample'
|
||||
minSdk = 24
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = '1.0'
|
||||
}
|
||||
}
|
||||
11
nix/vm-tests/android-dev-sample/offline.init.gradle
Normal file
11
nix/vm-tests/android-dev-sample/offline.init.gradle
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Build with the fetched dependencies as the only repository, so a build that
|
||||
// needs anything else fails instead of reaching for the network.
|
||||
beforeSettings { settings ->
|
||||
def repo = System.getenv('ANDROID_DEPS_REPO')
|
||||
settings.pluginManagement.repositories {
|
||||
maven { url = uri(repo) }
|
||||
}
|
||||
settings.dependencyResolutionManagement.repositories {
|
||||
maven { url = uri(repo) }
|
||||
}
|
||||
}
|
||||
12
nix/vm-tests/android-dev-sample/online.init.gradle
Normal file
12
nix/vm-tests/android-dev-sample/online.init.gradle
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Build with the real repositories: the fixed-output fetch of the dependencies.
|
||||
beforeSettings { settings ->
|
||||
settings.pluginManagement.repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
settings.dependencyResolutionManagement.repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
3
nix/vm-tests/android-dev-sample/settings.gradle
Normal file
3
nix/vm-tests/android-dev-sample/settings.gradle
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
// No repositories here: the init scripts in this directory add them, the
|
||||
// real ones to fetch the dependencies and a file repository to build offline.
|
||||
rootProject.name = 'sample'
|
||||
11
nix/vm-tests/android-dev-sample/src/main/AndroidManifest.xml
Normal file
11
nix/vm-tests/android-dev-sample/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application android:label="@string/app_name">
|
||||
<activity android:name=".MainActivity" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package test.hyperhive.sample;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
TextView view = new TextView(this);
|
||||
view.setText(R.string.app_name);
|
||||
setContentView(view);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">hyperhive sample</string>
|
||||
</resources>
|
||||
Loading…
Reference in a new issue