diff --git a/app/build.gradle b/app/build.gradle index bb76d2b..8f8ad4a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.application' +apply plugin: 'com.chaquo.python' android { compileSdkVersion 28 @@ -9,6 +10,16 @@ android { versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + python { + // If Chaquopy fails to find Python on your build machine, enable the following + // line and edit it to point to Python 3.4 or later. + // buildPython "C:/Python36/python.exe" + + staticProxy "hello" + } + ndk { + abiFilters "armeabi-v7a", "x86" + } } buildTypes { release { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2a2f5df..4d34f73 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,13 +3,14 @@ xmlns:android="http://schemas.android.com/apk/res/android"> - + diff --git a/app/src/main/java/com/chaquo/python/hello/MainActivity.java b/app/src/main/java/com/chaquo/python/hello/MainActivity.java deleted file mode 100644 index 2ec64d3..0000000 --- a/app/src/main/java/com/chaquo/python/hello/MainActivity.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.chaquo.python.hello; - -import android.support.v7.app.AppCompatActivity; -import android.os.Bundle; - -public class MainActivity extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - } -} diff --git a/app/src/main/python/hello.py b/app/src/main/python/hello.py new file mode 100644 index 0000000..6588387 --- /dev/null +++ b/app/src/main/python/hello.py @@ -0,0 +1,12 @@ +from android.os import Bundle +from android.support.v7.app import AppCompatActivity +from com.chaquo.python.hello import R +from java import jvoid, Override, static_proxy + + +class MainActivity(static_proxy(AppCompatActivity)): + + @Override(jvoid, [Bundle]) + def onCreate(self, state): + AppCompatActivity.onCreate(self, state) + self.setContentView(R.layout.activity_main) diff --git a/build.gradle b/build.gradle index a8d1d26..a461dd1 100644 --- a/build.gradle +++ b/build.gradle @@ -5,10 +5,15 @@ buildscript { repositories { google() jcenter() + maven { url "https://chaquo.com/maven" } } dependencies { classpath 'com.android.tools.build:gradle:3.5.0' + // Newer versions may be available: please check here: + // https://chaquo.com/chaquopy/doc/current/changelog.html + classpath 'com.chaquo.python:gradle:6.3.0' + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }