I'm trying to run some python code in my app. (in android studio). But, I keep getting this error: "No python interpreter configured for the model" and thus I can't run even the simplest code like: print("hello").
Some details:
In my main package I opened a new python package, so I automatically have init.py file and I tried to run there: print("hello"), and also tried to open another python file in the same directory and put my code there but it won't run.
gurdle.build-s are provided.
p.s: I searched the internet for this problem, but no one talks about android studio, and everyone talks about choosing another SDK. However I don't have python SDK in my 'project structure', and when I tried to search one for download, I couldn't find any in 'SDK manager'.
details:
___________________________________________________
apply plugin: 'com.android.application'
apply plugin: "com.chaquo.python"
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.eyal.doctorsapp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "x86", "armeabi-v7a"
}
python {
version "2.7.10"
}
}
___________________________________________________________________
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven{url "https://chaquo.com/maven"}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.chaquo.python:gradle:0.5.0"
}
}
Related
I'm a newbie for developing android program and I'm struggling to get the sample code "ndk-treasurehunt" running. I followed the instructions to build the project and ran into many errors. After modified the build.gradle file, I was able to make a few progress but right now I'm still stuck with the following error.
Build command failed.
Error while executing process C:\Users\xxx\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build C:\Users\xxx\ProgrammingAndroid\gvr-android-sdk-1.150.0\samples\ndk-treasurehunt.externalNativeBuild\cmake\debug\x86 --target treasurehunt_jni}
ninja: error: '../../../../libraries/jni/x86/libgvr.so', needed by '../../../../build/intermediates/cmake/debug/obj/x86/libtreasurehunt_jni.so', missing and no known rule to make it.
The build.gradle I modified is like this:
apply plugin: 'com.android.application'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
allprojects {
repositories {
jcenter()
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.google.vr.ndk.samples.controllerpaint"
minSdkVersion 25
targetSdkVersion 27
versionCode 1
versionName "1.0"
externalNativeBuild {
cmake {
cppFlags "-std=gnu++11"
arguments "-DGVR_LIBPATH=${project.rootDir}/libraries/jni",
"-DGVR_INCLUDE=${project.rootDir}/libraries/headers"
}
}
buildTypes {
release {
minifyEnabled = true
proguardFiles.add(file("${project.rootDir}/proguard-gvr.txt"))
}
}
ndk {
// This sample builds all architectures by default. Note that if you
// only want to build for a specific architecture, you need to
// remove the appropriate lines below. You also need to remove the
// .so files from the apk using
// "packagingOptions {exclude('lib/armeabi-v7a/*')}" in the android
// section.
abiFilters "arm64-v8a"
abiFilters "armeabi-v7a"
abiFilters "x86"
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
implementation 'com.google.vr:sdk-audio:1.150.0'
implementation 'com.google.vr:sdk-base:1.150.0'
}
build.dependsOn(':extractNdk')
Please help! Thank you!
Please ensure that your NDK is installed and extracted correctly by performing the following:
Add the NDK to Android Studio via: Tools -> SDK Manager -> SDK Tools -> NDK
Open Android Studio Terminal at the bottom of IDE or through View -> Tool Windows -> Terminal
Run the following command in the terminal gradelw :extractNdk
In the settings.gradle, uncomment the following line include ':sample:ndk-treasurehunt' which has since been replaced by include ':samples:ndk-hellovr' if you are using a newer NDK
i have a library which uses all of our apps.
except for shared code and resources i wanted to share gradle code.
each app is constructed:
some_app/
|
- settings.gradle
- build.gradle
|
- mylib/
|
-build.gradle
- other_lib/
- app/
|
- build.gradle
right now i'm talking about the build.gradle in the root dir. The one that defines buildScript closure with dependecies and allprojects{} closure as well.
i tried to use apply from: './mylib/gradle_files/baseProject.gradle'
it works, but then my app can't find the android plugin. for some reason the classpath dependencies were not injected into the build script!
i then tried to create a list and use that:
ext.projectBaseDependencies = ['com.android.tools.build:gradle:2.1.2', 'com.google.gms:google-services:3.0.0']
I then used the list in my closure:
apply from: './mylib/gradle_files/baseProject.gradle'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath projectBaseDependencies
}
}
it doesn't work, gradle does not find my variable defined in baseProject.gradle.
I have a hunch that apply from works AFTER buildScript closure is evaluated :-(
Is there any way to share gradle script code across ALL apps ? if not apply from, what CAN work ? skip configuration and config in afterEvaluate {} clause ?
Why not use a Gradle file in your common library? If your common library includes a build.gradle file, you can apply the android library plugin:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
consumerProguardFiles "proguard-rules.pro"
}
}
dependencies {
// Your common dependencies here
}
Then you can include the library in your project's settings.gradle:
include ':mobile'
project(':common').projectDir = new File("/Users/example/path/to/common")
Then add it to your dependencies in the project's build.gradle:
dependencies {
compile project(':common')
// Your other project dependencies
}
I am trying to debug through library code in Android Studio. But it shows unresolved symbols, i.e., red lines at lots of places.
My app build.gradle looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.kuldeep.customview"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
My project build.gradle file is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You're looking at the code for TextView, which is an Android platform class and not part of your app. Platform classes can refer to other "package private" classes that are not part of the visible API for an app. Android studio provides for you the ability to view platform source code like this so you can see how it works, but you can't make changes to it and you don't get access to all the actual compiled classes in the SDK.
The short story is that is regular and expected. If you were seeing this for your own app code (not platform classes or add-on libraries) then you'd have something to be concerned about.
2 possible reasons:
Gradle not synced.
Try syncing your gradle files using Gradle Sync.
SDK not updated.
Make sure your SDK is updated and that you have all the extra packages that you need installed. You can do that using SDK Manager.
I want to build an Android App with AndroidAnnotations.
Here is a simplified version on GitHub which fails to build/pre-process: https://github.com/aiQon/androidannotationsexample
The app is composed of a main app module and a library module.
Both use AndroidAnnotations (AA). The lib module has a workaround to find the AndroidManifest.xml in debug builds (it refers to the release manifest, because gradle does not build the debug variant for libs).
However, the manifest is found for the library module but not for the main app.
The gradle file of the main app is:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.0.1"
defaultConfig {
applicationId "de.stelle_beratung.androidannotationslibraryexample"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apt {
arguments {
androidManifestFile variant.outputs.processResources.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
dependencies {
compile project(":mylibrary")
apt "org.androidannotations:androidannotations:3.2+"
compile 'org.androidannotations:androidannotations-api:3.2+'
}
Gradle complains with:
http://pastebin.com/QZtnHcZD
Could someone please point me in the right direction on how to build this simplified project to have a controller Bean in the lib module and reference it successfully in the main app activity by using AA?
I appreciate any help.
Since android gradle plugin 14.4, the following line does not work anymore:
variant.outputs.processResources.manifestFile orvariant.processResources.manifestFile
You have to use this one instead:
variant.outputs[0].processResources.manifestFile
Please note if you have multiple outputs (when using splits), you may want to use another output (other index than zero).
Ok I got it. Was using Android Studio from the Canary Channel. Going back to Beta solved the issue because I could use android gradle plugin 0.12.2. This solved everything.
I have created a template project from minimum & target SDK 15 and compile SDK Google Glass Sneak Peek.
Ive only added this code to the MainActivity Class:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Card card = new Card(this);
card.setText("Hello World");
card.setFootnote("santiapps.com");
setContentView(card.toView());
}
but the Card words are all highlighted red saying Cannot resolve symbol Card.
I checked a StackOverflow which pointed to dependencies, but I checked my 2 build.gradle files (cause I don't know which it should be) and they have:
Innermost build.gradle:
apply plugin: 'android'
android {
compileSdkVersion 15
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 15
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
}
Outtermost build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Where dependencies are highlighted yellow saying 'dependencies' cannot be applied to groovy.lang.closure.
Ive clicked the button to resync gradle files but it doesn't get rid of the dependencies yellow warning.
I also get a red warning under the word google:
import com.google.android.glass.app.Card;
The other thing I noticed is that in a sample hello-world I downloaded I was able to see in File->Project Structure->PlatformSettings an entry for Android SDK but in my case I only get this:
So Im not sure what else to do. Thanks in advance (Android Studio 0.4.3)
You're not declaring the glass sdk dependency anywhere.
You'd either have to copy it from your $ANDROID_HOME/add-ons/addon-google_gdk-google-15/libs/gdk.jar to your local project and then add it to your dependencies like this:
dependencies {
compile files('libs/gdk.jar')
}
or upload it to a repository and then add it to your dependency section.
This was the solution for me:
http://b2cloud.com.au/uncategorized/google-glass-gdk-setting-up-the-project
It seems Android Studio doesn't specify that it must build that project with GDK even if you specifically tell it to when creating the New Project.
The previous answers are now outdated. Please don't directly include the gdk jar file.
Make sure you update Android Studio to the latest version (at least 0.5.5) and put:
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
in your app's build.gradle file. (For most projects, this is app/src/build.gradle.)