python同时 or android,How to configure Python interpretor in android studio

问题

I am trying to se python in android studio as a backend code for working on variables and producing answer. My MainActivity is in Java and a directory is created for python code. when I try to write code in python is tells that "no python interpreter configured for the module" I have added Chaquopy and Python Community Plugin. Also I want to know how can I send variables for my MainActivity to python and viceversa.

I am trying to add python in android studio. I have tried Chaquopy and also Python Community Plugin. I have tried to find answers on different places and guides too. But no Luck till now.

buildscript {

repositories {

google()

jcenter()

maven{url "https://chaquo.com/maven"}

}

dependencies {

classpath 'com.android.tools.build:gradle:3.3.1'

classpath "com.chaquo.python:gradle:0.5.0"

}

}

this is MainActivity and I want to send my variable "a" to python file to work on it.

package com.example.testingpython;

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);

int a=2;

String[] array={"My","Name","Java"};

}

}

回答1:

when I try to write code in python is tells that "no python interpreter configured for the module"

Only a few features of the Python Community Edition plugin will work properly in Android Studio. You can still write your Python code in Android Studio if you want, but most of the IDE assistance will be unavailable.

how can I send variables for my MainActivity to python and viceversa.

See the example code in the Chaquopy documentation and demo app.

来源:https://stackoverflow.com/questions/54667573/how-to-configure-python-interpretor-in-android-studio

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 在 Android Studio 中添加配置需要在 "Run/Debug Configurations" 面板中进行操作。 1. 打开 "Run/Debug Configurations" 面板,可以通过点击菜单栏 "Run" > "Edit Configurations" 或者通过点击左下角的 "Add Configuration" 按钮打开。 2. 点击 "Add New Configuration" 按钮或者 "+" 按钮,选择需要添加的配置类型,如 "Android App"。 3. 输入配置的名称,选择对应的模拟器或者设备,并设置其它相关参数。 4. 点击 "Apply" 或 "OK" 按钮保存配置。 5. 在 "Run/Debug Configurations" 面板中可以看到新添加的配置,可以在此面板中进行编辑和删除操作。 ### 回答2: Android Studio是具有编写Android应用程序所需的所有工具、集成开发环境和函数的IDE。在Android Studio中,可以通过添加配置来实现对应用程序的设置和管理。 添加配置的过程可能因配置类型和用途而异,但一般包含以下步骤: 1. 打开Android Studio。首先需要打开Android Studio,进入项目界面。 2. 找到“Edit Configurations”。在Android Studio窗口的左侧栏中找到“Run”或“Debug”按钮,单击该按钮旁边的下拉箭头,然后单击“Edit Configurations”。 3. 添加配置。在“Edit Configurations”窗口中,单击左上方的“+”按钮,选择要添加的配置类型,如“Android App”、“JUnit”、“Gradle”等等。根据需要,可以设置配置的各种属性,例如应用程序的名称、启动方式、运行时选项等。 4. 应用配置。完成配置设置后,单击“OK”按钮以保存和应用新的配置。如果有多个配置,可以使用下拉菜单在运行或调试应用程序时轻松地在它们之间切换。 总之,添加配置是Android Studio中一个非常重要的功能,可以帮助开发者更好地管理和设置他们的应用程序。我们需要仔细了解每个配置类型的用途和设置方法,并适时地将它们添加到我们的项目中,以便更好地管理我们的应用程序。 ### 回答3: Android Studio(下称AS)的configure指的是添加一些额外的设置或插件来改善开发体验,这里简单介绍如何进行configure。 首先,打开你的Android Studio并进入File>Settings(或选择Preferences on mac)。这里你可以看到很多选项,例如Build, Execution, Deployment、Appearance & Behavior、Editor等等,这些选项能帮助你定制化AS的界面和功能。 对于新手来说,可能最感兴趣的是Plugins,这里可以添加许多有用的插件,让开发更加高效。点击Plugins,可以看到顶部有一个Marketplace的选项,点击进去可以搜索并安装许多第三方插件,例如Kotlin、Flutter、React Native等的支持插件,还有很多调试和测试插件。在搜索插件之后,点击下载并安装即可。 另外一个常用的configure是SDK Manager。在设置界面的左侧,可以看到SDK Manager,这里可以添加或删除你所需的Android SDK。比如你需要在你的应用中使用Android 9.0 Pie SDK来编写代码,那么你需要在SDK Platforms中下载该SDK。如果你想添加特定的库或工具,你可以点击SDK Tools,找到并勾选你所需的工具。这使得你可以更加方便地开发你的应用。 AS还有很多其他的configure,需要根据你的开发需求进行选择。希望上述资料对你有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值