小编Cod*_*Law的帖子

通过 Android Studio (Gradle) 添加 osmdroid 库

我对移动开发很陌生,并尝试开发一个简单的 android 应用程序。对于我的项目,我需要 OSM(开放街道地图或更准确的 osmdroid。我尝试按照以下说明操作:https : //github.com/osmdroid/osmdroid/wiki/How-to-add-the-osmdroid-library-via- Gradle但不幸的是这对我不起作用。我想我只是在错误的地方插入了代码。 在此处输入图片说明

那就是它现在所在的地方。这是“build.gradle(:app)”中的代码:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    implementation 'org.osmdroid:osmdroid-android:(6.1.6)'
    implementation 'org.osmdroid:osmdroid-wms:(6.1.6)'
    implementation 'org.osmdroid:osmdroid-mapsforge:(6.1.6)'
    implementation 'org.osmdroid:osmdroid-geopackage:(6.1.6)'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Run Code Online (Sandbox Code Playgroud)

如果我尝试同步,这是错误消息:

FAILURE: Build failed with an exception.

 * What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not find org.osmdroid:osmdroid-android:(6.1.6).
     Required by:
         project :app
   > …
Run Code Online (Sandbox Code Playgroud)

android openstreetmap osmdroid android-studio build.gradle

1
推荐指数
1
解决办法
910
查看次数

使用不和谐机器人发送多行字符串作为消息时出现布局错误

我启动并运行了一个不和谐机器人。我的目标是在执行某个命令后向用户发送消息。这可行,但不知何故我的布局是错误的。我的字符串的第一行是正确的,之后其余的行将带有一些前导空格发送。

client = commands.Bot(command_prefix = '/')

@client.command()
async def start(ctx):
    welcome_message = f"""
    Welcome to my bot
    here is a new line which has leading spaces
    this line here has some aswell
    """
    await ctx.send(welcome_message)
Run Code Online (Sandbox Code Playgroud)

所以基本上我的消息是这样的:

Welcome to my bot
    here is a new line which has leading spaces
    this line here has some aswell
Run Code Online (Sandbox Code Playgroud)

即使welcome_message = welcome_message.lstrip()在发送之前也不能解决问题。

python layout multiline multilinestring discord.py

1
推荐指数
1
解决办法
506
查看次数