Я создал образец приложения с Android Studio, используя только медиаплеер и изображения и реализацию от Google.
После создания приложения я проверил его с помощью инструмента «Анализ» в Android Studio, чтобы увидеть, есть ли папка lib и(.so) файлы, как сказано в документации по поддержке 64-битных архитектур, но нет ничего, что означает, что приложение поддерживает 64-битные.
Я тестировал приложение на 64-битном телефоне, которое работало точно так же на 32-битной, но когда я загружаю в Google Play, они говорят (этот выпуск не соответствует 64-битному требованию Google Play).
Я испробовал метод (ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
, и то же самое произошло без изменений, может кто-нибудь объяснить мне, как это исправить или проверить вашу игровую консоль Google.
Build
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.preschoollearning.game"
minSdkVersion 19
targetSdkVersion 29
versionCode 18
versionName "2.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.gms:play-services-ads:18.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
MainActivity
public class MainActivity extends AppCompatActivity {
int id;
private MediaPlayer mediaPlayer;
private InterstitialAd interstitial;
GridLayout mainGrid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mainGrid = (GridLayout) findViewById(R.id.mainGrid);
//Set Event
setSingleEvent(mainGrid);
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("........");
// Create ad request.
AdRequest adRequest = new AdRequest.Builder().build();
AdView mAdView = (AdView) findViewById(R.id.adView);
mAdView.loadAd(adRequest);
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
}
private void setSingleEvent(GridLayout mainGrid) {
//Loop all child item of Main Grid
for (int i = 0; i < mainGrid.getChildCount(); i++) {
//You can see , all child item is CardView , so we just cast object to CardView
CardView cardView = (CardView) mainGrid.getChildAt(i);
final int finalI = i;
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (finalI == 0)
{
Intent intent = new Intent(MainActivity.this,AlphabetActivity.class);
startActivity(intent);
stopAudio();
}
else if (finalI == 1)
{
Intent intent = new Intent(MainActivity.this,NumberActivity.class);
startActivity(intent);
stopAudio();
}
else if (finalI == 2)
{
Intent intent = new Intent(MainActivity.this,ColorActivity.class);
startActivity(intent);
stopAudio();
}
else if (finalI == 3)
{
Intent intent = new Intent(MainActivity.this,ShapesActivity.class);
startActivity(intent);
stopAudio();
}
else if (finalI == 4)
{
Intent intent = new Intent(MainActivity.this,AnimalsActivity.class);
startActivity(intent);
stopAudio();
}
else if (finalI == 5)
{
Intent intent = new Intent(MainActivity.this,BirdsActivity.class);
startActivity(intent);
stopAudio();
}
else if (finalI == 6)
{
Intent intent = new Intent(MainActivity.this,FlagsActivity.class);
startActivity(intent);
stopAudio();
}
else if (finalI == 7)
{
Intent intent = new Intent(MainActivity.this,VehicalsActivity.class);
startActivity(intent);
stopAudio();
}
}
});
}
}
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
super.onBackPressed();
displayInterstitial();
finish();
}
//Play Audio
private void playAudio(int paramInt) {
this.mediaPlayer = MediaPlayer.create(this, paramInt);
this.mediaPlayer.setScreenOnWhilePlaying(true);
this.mediaPlayer.start();
}
//Stop Audio
private void stopAudio() {
try {
if (this.mediaPlayer != null) {
if (this.mediaPlayer.isPlaying())
this.mediaPlayer.stop();
this.mediaPlayer.release();
this.mediaPlayer = null;
}
} catch (Exception localException) {
while (true)
System.out.println("XML Pasing Excpetion = " + localException);
}
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
stopAudio();
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
stopAudio();
}
}
OtherActivity и то же самое в других действиях
public class AnimalsActivity extends AppCompatActivity implements View.OnClickListener {
private ImageView imgAnimals;
private MediaPlayer mediaPlayer;
private int position;
private InterstitialAd interstitial;
ImageButton btn_voice;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_animals);
playAudio(Constants.ANIMALS_SOUND[position]);
btn_voice = findViewById(R.id.btn_voice);
btn_voice.setOnClickListener(this);
AdView mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("....");
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
imgAnimals = findViewById(R.id.imgAnimals);
imgAnimals.setImageResource(Constants.ANIMALS_IMAGES[position]);
imgAnimals.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Play word audio when tap in Word Images
playAudio(Constants.ANIMALS_SOUND[position]);
}
});
Button btnPrevious = findViewById(R.id.btnPrev3);
Button btnNext = findViewById(R.id.btnNex3);
Button play = findViewById(R.id.play);
btnPrevious.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (position > 0) {
updateActivity(position - 1);
position = position - 1;
} else {
updateActivity((Constants.ANIMALS_IMAGES.length - 1));
position = Constants.ANIMALS_IMAGES.length - 1;
}
}
});
btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (position < (Constants.ANIMALS_IMAGES.length - 1)) {
updateActivity(position + 1);
position = position + 1;
} else {
updateActivity(0);
position = 0;
}
}
});
play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
playAudio(Constants.ANIMALS_SOUND[position]);
}
});
}
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
super.onBackPressed();
displayInterstitial();
finish();
}
private void updateActivity(final int position) {
imgAnimals.setImageResource(Constants.ANIMALS_IMAGES[position]);
playAudio(Constants.ANIMALS_SOUND[position]);
imgAnimals.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Play word audio when tap in Word Images
playAudio(Constants.ANIMALS_SOUND[position]);
}
});
}
// Play audio
private void playAudio(int paramInt) {
stopAudio();
if (this.mediaPlayer != null)
this.mediaPlayer.reset();
this.mediaPlayer = MediaPlayer.create(this, paramInt);
this.mediaPlayer.setScreenOnWhilePlaying(true);
this.mediaPlayer.start();
}
// Stop audio
private void stopAudio() {
try {
if (this.mediaPlayer != null) {
if (this.mediaPlayer.isPlaying())
this.mediaPlayer.stop();
this.mediaPlayer.release();
this.mediaPlayer = null;
}
} catch (Exception localException) {
while (true)
System.out.println("XML Pasing Excpetion = " + localException);
}
}
protected void onPause() {
super.onPause();
overridePendingTransition(0, 0);
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.btn_voice){
Intent intent = new Intent(AnimalsActivity.this,AnimalVoiceActivity.class);
intent.putExtra("id", 1);
startActivity(intent);
finish();
stopAudio();
}
}
}
Constant
public class Constants {
static final int[] ALPHABET_IMAGES = { R.drawable.alphabet_1, R.drawable.alphabet_2,
R.drawable.alphabet_3, R.drawable.alphabet_4, R.drawable.alphabet_5, R.drawable.alphabet_6,
R.drawable.alphabet_7, R.drawable.alphabet_8, R.drawable.alphabet_9, R.drawable.alphabet_10,
R.drawable.alphabet_11, R.drawable.alphabet_12, R.drawable.alphabet_13, R.drawable.alphabet_14,
R.drawable.alphabet_15, R.drawable.alphabet_16, R.drawable.alphabet_17, R.drawable.alphabet_18,
R.drawable.alphabet_19, R.drawable.alphabet_20, R.drawable.alphabet_21, R.drawable.alphabet_22,
R.drawable.alphabet_23, R.drawable.alphabet_24, R.drawable.alphabet_25, R.drawable.alphabet_26};
static final int[] APHABET_SOUND = { R.raw.alphabet_1, R.raw.alphabet_2,
R.raw.alphabet_3, R.raw.alphabet_4, R.raw.alphabet_5, R.raw.alphabet_6,
R.raw.alphabet_7, R.raw.alphabet_8, R.raw.alphabet_9, R.raw.alphabet_10,
R.raw.alphabet_11, R.raw.alphabet_12, R.raw.alphabet_13, R.raw.alphabet_14,
R.raw.alphabet_15, R.raw.alphabet_16, R.raw.alphabet_17, R.raw.alphabet_18,
R.raw.alphabet_19, R.raw.alphabet_20, R.raw.alphabet_21, R.raw.alphabet_22,
R.raw.alphabet_23, R.raw.alphabet_24, R.raw.alphabet_25, R.raw.alphabet_26 };
}
AndroidManifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
android:name=".SplashScreen"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:screenOrientation="portrait" />
<activity
android:name=".AnimalsActivity"
android:screenOrientation="portrait" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="@string/app_id" />
</application>
</manifest>
Apk Analyze