篮之新喜 发表于 2024-7-16 01:35:19

安装 Android Studio 2024.1.1.6(Koala SDK35)和过程题目解决

记载更新Android Studio版本及适配Android V应用配置的一些过程题目。


[*]安装包:android-studio-2024.1.1.6-windows.exe
[*]原版本:Android Studio23.2.1.23
Koala 安装过程

Uninstall old version 不会删除本来配置(左下角提示)
   https://img-blog.csdnimg.cn/direct/3e471f79a8c348f3b1354dd5af3354f3.png   Uninstall old version      https://img-blog.csdnimg.cn/direct/319dc3b0562f461490beef8805ca6e82.png   Android Studio Setup   
   https://img-blog.csdnimg.cn/direct/8fb8bcc7c4a0480fb5e1fc1197ea5917.png   Choose Component    Configuration Settings 可自选路径 E:\SOFTWARE\Android\Android Studio 24.1.1.6
   https://img-blog.csdnimg.cn/direct/442c9afd39c24fe5af376c67b15c7c95.png   Configuration Settings    Choose Start Menu Folder 配置桌面开始图标
   https://img-blog.csdnimg.cn/direct/057808bb82d6439da2e4a2b9f12387ce.png   Choose Start Menu Folder   
 安装完成 ,提示马上启动
   https://img-blog.csdnimg.cn/direct/38704dfcc8db4c61882deba4378ca0f3.png   Install Complete    【题目解决】启动报错 Operation not supported: bind 

Start fail
https://img-blog.csdnimg.cn/direct/8989a5a2976a4d97ac49414888bcb9be.png
   Internal error. Please refer to https://issuetracker.google.com/issues/new?component=192708
java.net.SocketException: Operation not supported: bind
    at java.base/sun.nio.ch.UnixDomainSockets.bind0(Native Method)
    at java.base/sun.nio.ch.UnixDomainSockets.bind(UnixDomainSockets.java:129)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.unixBind(ServerSocketChannelImpl.java:319)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:292)
    at java.base/java.nio.channels.ServerSocketChannel.bind(ServerSocketChannel.java:224)
    at com.intellij.platform.ide.bootstrap.DirectoryLock.tryListen(DirectoryLock.java:281)
    at com.intellij.platform.ide.bootstrap.DirectoryLock.lockOrActivate(DirectoryLock.java:147)
    at com.intellij.platform.ide.bootstrap.StartupUtil$lockSystemDirs$result$1.invokeSuspend(main.kt:528)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
-----
Your JRE: 17.0.10+0--11609105 amd64 (JetBrains s.r.o.)
E:\SOFTWARE\Android\Android Studio 24.1.1.6\jbr
解决方案:到bin文件下实行studio.bat打开(大概双击打开studio.bat--For Windows)
如路径:E:\SOFTWARE\Android\Android Studio 24.1.1.6\bin\studio.bat
IDE初始化和使用

如果没有配置SDK,打开软件就会提示
https://img-blog.csdnimg.cn/direct/62ec15eb9b5046db9d31efd146d10c78.png
https://img-blog.csdnimg.cn/direct/cca10c69360c4ff6a8666edf2e6fe466.png
然后打开项目标时间会提示选用Android Studio还是Project的SDK。
https://img-blog.csdnimg.cn/direct/1aeb8bee6a5348a7b84eb193c3e62e76.png
   To keep results consistent between IDE and command line builds, only one path can be used. Do you want to: 
Use Android Studio's default SDK (modifies the project's local.properties file.) 
Use the project's SDK (modifies Android Studio's default.)  Note that switching SDKs could cause compile errors if the selected SDK doesn't have the necessary Android platforms or build tools.
【配置】SDK和Gradle

当前Android Studio无法下载高版本的SDK和Gradle,可以自行下载好然后放到相应工作路径。
Android V的preview SDK和build tool,分别拷贝到SDK\build-tools和Sdk\platforms文件目次即可。那么配置项目gradle的时间须要名称对应。
https://img-blog.csdnimg.cn/direct/67859936be704dec9623b1bc8c20419e.pnghttps://img-blog.csdnimg.cn/direct/4ce17466d839406a89a690d02b81b738.png
【题目解决】Namespace not specified.

Build Output
https://img-blog.csdnimg.cn/direct/8f3c993d99214d78a834b9624b21b8d6.png
   Namespace not specified. Specify a namespace in the module's build file: E:\code\Demo_hotfix\build.gradle. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.
If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.
    A problem occurred configuring root project 'Demo'.
> Could not create an instance of type com.android.build.api.variant.impl.ApplicationVariantImpl.
   > Namespace not specified. Specify a namespace in the module's build file: E:\code\Demo_hotfix\build.gradle. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 7s
分析:在Android U上编译还没有命名空间的要求。
解决方案:在app的build.gradle添加namespace
android {
    namespace 'com.ddd.demo'
} 应用Debug

当前配置
//这个看着没用,kotlin才需要 添加android-
ext {
    compileSdkVersion = 'android-VanillaIceCream'
}

android {
    namespace 'com.ddd.demo'
    compileSdkPreview 'VanillaIceCream'
    //compileSdkVersion 35
    buildToolsVersion '35.0.0 rc3'
    defaultConfig {
      applicationId "com.ddd.demo"
      minSdkVersion 30
      targetSdkVersion 35
      versionName getVersionNamePrefix()
    }
} 修改namespace、sdk版本等配置后编译报错,其实可以通过形貌Recommendation找到解决方案。
https://img-blog.csdnimg.cn/direct/cb3841f21bc247f392db4f093f9140df.png
1、compileSdkPreview

第一条只是警告,还不是报错。
   compileSdkPreview = "VanillaIceCream" has not been tested with this version of the Android Gradle plugin.
This Android Gradle plugin (8.5.0-alpha08) was tested up to compileSdk = 34.
If you are already using the latest preview version of the Android Gradle plugin,
you may need to wait until a newer version with support for compileSdkPreview = "VanillaIceCream" is available.
For more information refer to the compatibility table:
https://d.android.com/r/tools/api-level-support
To suppress this warning, add/update
    android.suppressUnsupportedCompileSdk=VanillaIceCream
to this project's gradle.properties.
2、:processDebugMainManifest ※

   > Task :processDebugMainManifest FAILED
Incorrect package="com.ddd.phone" found in source AndroidManifest.xml: E:\code\Demo_V_hotfix\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.ddd.phone" from the source AndroidManifest.xml: E:\code\Demo_V_hotfix\AndroidManifest.xml.
Execution failed for task ':processDebugMainManifest'.
> Incorrect package="com.ddd.phone" found in source AndroidManifest.xml: E:\code\Demo_V_hotfix\AndroidManifest.xml.
  Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
  Recommendation: remove package="com.ddd.phone" from the source AndroidManifest.xml: E:\code\Demo_V_hotfix\AndroidManifest.xml.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 717ms
44 actionable tasks: 1 executed, 43 up-to-date
解决:将build.gradle的命名空间跟AndroidManifest.xml配置的packages内容一致。
3、Incorrect package="xxxx" found in AndroidManifest.xml

是由于界说了差别的命名空间和历程包名等,固然说建议移除AndroidManifest中的packages配置,但是根由不是这个,解决了题目2就能解决此题目。
   Incorrect package="com.ddd.phone" found in source AndroidManifest.xml: E:\code\Demo_V_hotfix\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.ddd.phone" from the source AndroidManifest.xml: E:\code\Demo_V_hotfix\AndroidManifest.xml.

其他

官方说明 :设置 Android 15 SDK  |  Android Developers
//更改 gradle 配置:
//AGP > 7.0.0:
//groovy:
android {
    compileSdkPreview "VanillaIceCream"
    ...
    defaultConfig {
      targetSdkPreview "VanillaIceCream"
    }
}


//kotlin:
android {
    compileSdkPreview = "VanillaIceCream"
    ...
    defaultConfig {
      targetSdkPreview = "VanillaIceCream"
    }
}


//AGP 4.2.0 或更低:
//groovy:
android {
    compileSdkVersion "android-VanillaIceCream"
    ...
    defaultConfig {
      targetSdkVersion "android-VanillaIceCream"
    }
}


//kotlin:
android {
    compileSdkPreview = "android-VanillaIceCream"
    ...
    defaultConfig {
      targetSdkPreview = "android-VanillaIceCream"
    }
}

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 安装 Android Studio 2024.1.1.6(Koala SDK35)和过程题目解决