新建安卓项目中的各种问题
作者:互联网
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 来源: https://www.cnblogs.com/8335IT/p/16602150.html