首页 > 其他分享 >新建安卓项目中的各种问题

新建安卓项目中的各种问题

时间:2022-08-24 10:55:13浏览次数:134  
标签:各种 建安 项目 repositories gradle maven callbacks google activity

1setting.gradle

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
    }
}

编译报错:

 

 

What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
   > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(http://maven.aliyun.com/nexus/content/groups/public/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.3.3/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. 

如何修改:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}

 

2 安卓打印有很多种

 cPP :https://blog.csdn.net/jjwwmlp456/article/details/89320343

 

3 安卓代码如何触发nativeactivity的回调:

extern "C" JNIEXPORT void ANativeActivity_onCreate(ANativeActivity *activity,
                                                   void *savedState,
                                                   size_t savedStateSize) {

  activity->callbacks->onStart = onStart;
  activity->callbacks->onResume = onResume;
  activity->callbacks->onSaveInstanceState = onSaveInstanceState;
  activity->callbacks->onPause = onPause;
  activity->callbacks->onStop = onStop;
  activity->callbacks->onDestroy = onDestroy;
  activity->callbacks->onWindowFocusChanged = onWindowFocusChanged;
  activity->callbacks->onNativeWindowCreated = onNativeWindowCreated;
  activity->callbacks->onNativeWindowResized = onNativeWindowResized;
  activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded;
  activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed;
  activity->callbacks->onInputQueueCreated = onInputQueueCreated;
  activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed;
  activity->callbacks->onContentRectChanged = onContentRectChanged;
  activity->callbacks->onConfigurationChanged = onConfigurationChanged;
  activity->callbacks->onLowMemory = onLowMemory;


}

 

3.1继承关系

public class MainActivity extends NativeActivity 
继承 NativeActivity  不是app activity

3.2 manifest.xml(一定要加,否则会闪退)

  <meta-data
                android:name="android.app.lib_name"
                android:value="native-activity" />

 。。。。。持续更新中

标签:各种,建安,项目,repositories,gradle,maven,callbacks,google,activity
From: https://www.cnblogs.com/8335IT/p/16602150.html

相关文章

  • 1038 虫洞 Wormholes 判断负环+各种细节
     链接:https://ac.nowcoder.com/acm/contest/26077/1038来源:牛客网题目描述John在他的农场中闲逛时发现了许多虫洞。虫洞可以看作一条十分奇特......
  • PyCharm中安装第三方模块以及项目打包
    1.前言除了pip工具可以安装python第三方库外,PyCharm也是可以安装第三方库的。pipinstall包名#E:\Python\Lib\site-packages这个路径下可以查看已安装的第三方包2.......
  • Python3项目初始化9-->用户登录和用户管理和密码加密
    26、用户登录页面修改使用用户登录现成的模板。鼠标右键查看页面原代码,直接复制粘贴:https://v3.bootcss.com/examples/signin/调整login.html代码,{%loadstatic%}<!docty......
  • Java项目生成电脑桌面快捷脚本
    一、场景说明经常需要查询以及设置手机验证码,一般验证码都是放在Redis,为了节省短信费,可以直接设置Redis,本篇内容主要介绍如何便捷查询和设置手机验证码,非开发人员也会......
  • Python3项目初始化8-->css和bootstrap入门学习
    24、CSS基础HTML盒模型divspanCSS选择器,常见属性值Bootstrap栅格系统,表单,表格,常用组件。Div一个盒子,默认站一行Span行内元素P段落元素为什么需要div?t......
  • 在vue项目中使用UEditor--plus
    1:UEditor-plus富文本编辑器如何在vue项目中使用备注:UEditor是由百度web前端研发部开发的所见即所得的开源富文本编辑器,由于该项目不在维护;程序员自发对其进行了维护,详见......
  • vue项目目录结构划分
     1.dist---编译之后的项目文件2.src---开发目录3.src/assets---静态资源src/assets/less---公共lesssrc/assets/img---图片资源4.src/components---组件5.src/pag......
  • 一天一个知识点-----vue项目简单引入svg
    项目背景:vue3.0+elementPlus注意项目结构,主要涉及的几个文件及文件夹---直接上代码----1.最开始是要下载包npminstallsvg-sprite-loader2.配置项目的配置文件vu......
  • Vue项目跑不起来 Uncaught SyntaxError: The requested module '/node_modules/.vit
    一:问题介绍vue项目运行跑不起来提示Browserslist:caniuse-liteisoutdated.Pleaserunnpxbrowserslist@latest--update-db遇到这个情况首先想到重新安装依赖重启项目......
  • 创建一个VUE项目
    前期准备1、安装node,官网安装(自带npm)2、安装npm国内镜像cnpm:npminstall-gcnpm;安装后可能在项目中无法使用,执行cnpminstallexpress-g3、安装开源前端打包工具webpa......