Skip to content

Commit

Permalink
Fix examples/android code to actually run successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
nkoroste committed Dec 23, 2020
1 parent ae658ea commit c19698b
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 8 deletions.
9 changes: 9 additions & 0 deletions examples/android/app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ android_binary(
incremental_dexing = 0,
manifest = "src/main/AndroidManifest.xml",
multidex = "native",
manifest_values = {
"lib_name": "lib",
},
deps = [
"//lib",
],
Expand All @@ -20,6 +23,9 @@ android_binary(
incremental_dexing = 0,
manifest = "src/main/AndroidManifest.xml",
multidex = "native",
manifest_values = {
"lib_name": "lib2",
},
deps = [
"//lib2",
],
Expand All @@ -32,6 +38,9 @@ android_binary(
incremental_dexing = 1,
manifest = "src/main/AndroidManifest.xml",
multidex = "native",
manifest_values = {
"lib_name": "lib",
},
deps = [
"//lib",
],
Expand Down
20 changes: 17 additions & 3 deletions examples/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="examples.android.app">
<uses-sdk android:minSdkVersion="23"
android:targetSdkVersion="23"
android:maxSdkVersion="29" />
<uses-sdk
android:minSdkVersion="23"
android:targetSdkVersion="23"
android:maxSdkVersion="29" />

<application
android:label="Rules Kotlin App">
<activity
android:name="examples.android.${lib_name}.MainActivity"
android:label="Bazel Tutorial App" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
8 changes: 7 additions & 1 deletion examples/android/lib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="examples.android.lib"/>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="examples.android.lib">
<uses-sdk
android:minSdkVersion="23"
android:targetSdkVersion="23"
android:maxSdkVersion="29" />
</manifest>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package examples.android.lib

import android.app.Activity
import android.app.AlertDialog
import android.os.Bundle
import android.widget.Button
import android.widget.LinearLayout
import android.widget.LinearLayout.LayoutParams
import androidx.appcompat.app.AlertDialog

class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
1 change: 1 addition & 0 deletions examples/android/lib2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ android_library(
custom_package = "examples.android.lib2",
manifest = "src/main/AndroidManifest.xml",
visibility = ["//visibility:public"],
resource_files = glob(["res/**"]),
deps = [
":util",
"@maven//:androidx_appcompat_appcompat",
Expand Down
8 changes: 7 additions & 1 deletion examples/android/lib2/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="examples.android.lib2"/>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="examples.android.lib2">
<uses-sdk
android:minSdkVersion="23"
android:targetSdkVersion="23"
android:maxSdkVersion="29" />
</manifest>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package examples.android.lib2;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import androidx.appcompat.app.AlertDialog;

public class MainActivity extends Activity {
@Override protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -19,7 +19,7 @@ public class MainActivity extends Activity {

new AlertDialog.Builder(this)
.setTitle("Blah")
.setMessage("Blah blah blah?")
.setMessage(R.string.little_bat)
.show();
}
}

0 comments on commit c19698b

Please sign in to comment.